在jetty上部署时出错

时间:2015-08-16 10:33:23

标签: java spring servlets

我有gradle应用程序。我为每次api调用错误部署错误后收到错误:

java.lang.LinkageError: loader constraint violation: loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) previously initiated loading for a different type with name     "com/fasterxml/jackson/core/JsonFactory"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:217)
    at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:208)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:161)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:101)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:167)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:71)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:126)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)

我的gradle依赖:

compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
compile 'org.springframework:spring-core:3.2.3.RELEASE'
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'

compile 'javax.servlet:jstl:1.2'
compile 'com.sun.jersey:jersey-client:1.18.1'
compile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'mysql:mysql-connector-java:5.1.35'
compile 'com.nimbusds:nimbus-jose-jwt:3.10'
compile 'joda-time:joda-time:2.8.2'
compile 'com.google.oauth-client:google-oauth-client:1.20.0'
compile 'com.google.api-client:google-api-client:1.20.0'
compile 'com.google.http-client:google-http-client:1.20.0'
compile 'com.google.http-client:google-http-client-jackson:1.20.0'
compile 'com.google.apis:google-api-services-plus:v1-rev217-1.20.0'

compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpcomponents-core:4.4.1'

compile 'org.glassfish.jersey.core:jersey-common:2.4.1'

providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'javax.servlet.jsp:jsp-api:2.1'
//providedCompile 'javax:javaee-api:7.0'
runtime 'javax.servlet:jstl:1.2'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.slf4j:slf4j-log4j12:1.7.5'
compile 'org.slf4j:jcl-over-slf4j:1.7.5'
compile 'log4j:log4j:1.2.17'
compile 'org.codehaus.jackson:jackson-jaxrs:1.9.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'javax.servlet.jsp:jsp-api:2.1'
runtime 'javax.servlet:jstl:1.2'
testCompile 'junit:junit:4.11'

testCompile 'org.mockito:mockito-all:1.9.5'

我认为我有一些相互矛盾的依赖关系。但是我无法猜出那些是什么。

1 个答案:

答案 0 :(得分:0)

你的杰克逊图书馆与其他杰克逊图书馆有冲突。这可能是某些hr依赖的依赖 - 或者杰克逊库已经存在于共享库中的Jetty中