Tag: maven

Java Jersey应用程序启动时的NoSuchMethodError

尝试在Tomcat上启动Jersey应用程序时,我遇到了一个非常奇怪的错误。 相同的代码适用于其他计算机。 我尝试重新安装tomcat,我所有的maven依赖项,甚至是Eclipse和Java本身,没有运气。 我觉得看起来像是一个糟糕的泽西版本正在加载? 任何指向正确的方向将不胜感激。 这是有效的pom: http : //pastebin.com/NacsWTjz 而实际的pom: http : //pastebin.com/H6sHe4ce 2015-02-13 13:43:40,870 [localhost-startStop-1] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/middleware-server] – StandardWrapper.Throwable java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:304) at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:285) at org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1031) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4901) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5188) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at […]

我应该在Maven项目中为JAXB RI使用哪些工件?

从历史上看,我总是在我的Maven项目中使用以下JAXB RI工件: com.sun.xml.bind:jaxb-impl – 运行时 com.sun.xml.bind:jaxb-xjc – 模式编译器 com.sun.xml.bind:jaxb-jxc – 模式生成器 由于大约版本2.2.10*这些工件现在被描述为“旧” : com.sun.xml.bind:jaxb-impl 旧的JAXB运行时模块。 所以看起来这些工件现在已经过时了。 问题是: 应该使用哪些工件?

Spring-Boot Jersey:允许泽西岛提供静态内容

该应用程序使用JDK 8,Spring Boot和Spring Boot Jersey启动程序,并打包为WAR(尽管它是通过Spring Boot Maven插件在本地运行的)。 我想要做的是将我生成的文档(在构建时)生成为欢迎页面。 我尝试了几种方法: 让Jersey为静态内容提供服务,方法是在application.properties配置正确的init参数,如下所述 引入metadata-complete=false web.xml ,以便将生成的HTML文档列为欢迎文件。 这些都没有成功。 我想避免为了提供静态文件而启用Spring MVC或创建Jersey资源。 任何想法? 这是Jersey配置类(我试图在那里添加ServletProperties.FILTER_STATIC_CONTENT_REGEX失败了): @ApplicationPath(“/”) @ExposedApplication @Component public class ResourceConfiguration extends ResourceConfig { public ResourceConfiguration() { packages(“xxx.api”); packages(“xxx.config”); property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true); property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); } } 这里是Spring Boot应用程序类(我尝试使用spring.jersey.init.jersey.config.servlet.filter.staticContentRegex=/.*html添加一个application.properties但它没有用,我不确定是什么属性键应该在这里): @SpringBootApplication @ComponentScan @Import(DataConfiguration.class) public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { […]

对于HttpServletRequest类型,未定义方法getDispatcherType()

当我从Eclipse运行我的应用程序时,它运行时没有任何错误的servlet api 3.1.0和3.0.1。 javax.servlet javax.servlet-api 3.1.0 我使用tomcat 8.0.21进行eclipse。 我在ubuntu机器上设置了tomcat8,它运行在tomcat 8.0.14稳定版本上。 不幸的是,如果我使用servlet api 3.1.0,我会收到以下错误消息。 但它适用于旧版本3.0.1。 root cause org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: [50] in the generated java file: [/var/lib/tomcat8/work/Catalina/localhost/ROOT/org/apache/jsp/WEB_002dINF/view/templates/login_002dtemplate_jsp.java] The method getDispatcherType() is undefined for the type HttpServletRequest Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:450) org.apache.jasper.compiler.Compiler.compile(Compiler.java:361) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) […]

解决Apache Spark中的依赖性问题

构建和部署Spark应用程序时的常见问题是: java.lang.ClassNotFoundException 。 object x is not a member of package y编译错误object x is not a member of package y 。 java.lang.NoSuchMethodError 如何解决这些问题?

Eclipse中的Jersey Maven quickstart原型

我试图通过maven的帮助正常创建泽西但是我总是像scrennshoot一样得到这个结构,并且通常没有错误?! 它看起来不像泽西岛常见的布局。 我正在使用这个: org.glassfish.jersey.archetypes jersey-quickstart-webapp 2.16 pom.xml中: 4.0.0 org.test serverSide 0.0.1-SNAPSHOT jar serverSide http://maven.apache.org UTF-8 junit junit 3.8.1 test

在JAX-RS上使用UriBuilder的AbstractMethodError

我正在尝试使用异步响应构建REST Web服务。 我在网上查看了这个错误,但是,没有一个解决方案对我有用。 我不确定如何去做。 这是REST服务的代码,它有AsyncResponse和@Suspended ,它们取自pom.xml指定的jar文件,我将在下面提供。 问题是,在部署战争时,我得到一个例外: java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:651) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.50 logs 我的class级如下: package com.crudapp; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import javax.annotation.Generated; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import […]

在IntelliJ IDEA中将外部库添加到工件jar中

如何在IntelliJ IDEA中向项目添加外部库,以便在构建工件时它仍然可以访问库中的类? 我从Project Structure创建了一个新的Jar工件,然后将外部JAR添加到Libraries,然后在Modules List中检查它,最后将它添加到Artifact的Output中。 这些都不起作用。 当我构建并尝试运行我的应用程序时,它会抛出一个错误: Exception in thread “main” java.lang.NoClassDefFoundError: 我错过了什么,或者我完全错了?

Eclipse / Idea忽略了Maven Java版本配置

我有: org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 但我宣布:没有问题: public enum DirectoryWatchService { INSTANCE; private java.util.Optional test; private java.nio.file.Files files; } Eclipse不打扰。 IntelliJ既不是。 即使是Maven也不会打扰。 我甚至可以做一个mvn清洁包 。 在没有任何警告的情况下构建健康的东西。