Maven Java依赖问题

时间:2015-05-26 11:40:56

标签: java maven

我在tomcat启动时收到以下警告。可能是因为罐子和传递依赖之间存在一些冲突,可能是吗?但是有这么多人我有点困惑。你能帮我解决这个问题吗?

May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Curiosity\WEB-INF\lib\avro-repo-bundle-1.7.4-20140320.142748-2.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\_home\main\Personalisation\cur5\Curiosity\target\Curiosity\WEB-INF\lib\avro-repo-bundle-1.7.5-1124-20140320.140827-4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Curiosity\target\Curiosity\WEB-INF\lib\javax.servlet-3.0.0.v201112011016.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Curiosity\target\Curiosity\WEB-INF\lib\javax.servlet-3.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Curiosity\target\Curiosity\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:04 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Curiosity\target\Curiosity\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
May 26, 2015 12:33:09 PM org.apache.catalina.startup.ContextConfig checkHandlesTypes
WARNING: Unable to load class [org.apache.avro.repo.server.RepositoryServer$RepoConfigModule$NoneServlet] to check against the @HandlesTypes annotation of one or more ServletContentInitializers. 

这是mvn dependency:tree

[INFO] Curiosity:Curiosity:war:1.0-SNAPSHOT
[INFO] +- junit:junit:jar:3.8.1:test (scope not updated to compile)
[INFO] +- org.springframework:spring-core:jar:4.0.1.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-web:jar:4.0.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.0.1.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.0.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-context:jar:4.0.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.0.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.0.1.RELEASE:compile
[INFO] +- org.apache.kafka:kafka_2.9.2:jar:0.8.0:compile
[INFO] |  +- org.apache.zookeeper:zookeeper:jar:3.3.4:compile
[INFO] |  |  \- jline:jline:jar:0.9.94:compile
[INFO] |  +- org.scala-lang:scala-library:jar:2.9.2:compile
[INFO] |  +- log4j:log4j:jar:1.2.15:compile
[INFO] |  |  +- javax.mail:mail:jar:1.4:compile
[INFO] |  |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  +- com.sun.jdmk:jmxtools:jar:1.2.1:compile
[INFO] |  |  \- com.sun.jmx:jmxri:jar:1.2.1:compile
[INFO] |  +- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
[INFO] |  +- org.slf4j:slf4j-simple:jar:1.6.4:compile
[INFO] |  +- org.scala-lang:scala-compiler:jar:2.9.2:compile
[INFO] |  +- com.101tec:zkclient:jar:0.3:compile
[INFO] |  +- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] |  +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] |  \- com.yammer.metrics:metrics-annotation:jar:2.2.0:compile
[INFO] +- org.apache.avro:avro:jar:1.7.3:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.8.8:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.8:compile
[INFO] |  +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.6.4:compile
[INFO] +- org.apache.avro.repo:avro-repo-bundle:jar:1.7.5-1124-SNAPSHOT:compile
[INFO] |  +- org.apache.avro.repo:avro-repo-server:jar:1.7.5-1124-SNAPSHOT:compile
[INFO] |  |  +- org.apache.avro.repo:avro-repo-common:jar:1.7.5-1124-SNAPSHOT:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-server:jar:8.1.8.v20121106:compile
[INFO] |  |  |  +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-continuation:jar:8.1.8.v20121106:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-http:jar:8.1.8.v20121106:compile
[INFO] |  |  |     \- org.eclipse.jetty:jetty-io:jar:8.1.8.v20121106:compile
[INFO] |  |  |        \- org.eclipse.jetty:jetty-util:jar:8.1.8.v20121106:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-servlet:jar:8.1.8.v20121106:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-security:jar:8.1.8.v20121106:compile
[INFO] |  |  +- com.google.inject:guice:jar:3.0:compile
[INFO] |  |  |  \- javax.inject:javax.inject:jar:1:compile
[INFO] |  |  +- com.google.inject.extensions:guice-servlet:jar:3.0:compile
[INFO] |  |  +- com.sun.jersey:jersey-server:jar:1.15:compile
[INFO] |  |  |  \- asm:asm:jar:3.1:compile
[INFO] |  |  \- com.sun.jersey.contribs:jersey-guice:jar:1.15:compile
[INFO] |  |     \- com.sun.jersey:jersey-servlet:jar:1.15:compile
[INFO] |  \- org.apache.avro.repo:avro-repo-client:jar:1.7.5-1124-SNAPSHOT:compile
[INFO] |     \- com.sun.jersey:jersey-client:jar:1.15:compile
[INFO] +- com.linkedin.camus:camus-api:jar:0.1.0-SNAPSHOT:compile
[INFO] |  +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.2.0:compile
[INFO] |  |  +- org.apache.hadoop:hadoop-yarn-common:jar:2.2.0:compile
[INFO] |  |  |  +- org.apache.hadoop:hadoop-yarn-api:jar:2.2.0:compile
[INFO] |  |  |  \- com.sun.jersey.jersey-test-framework:jersey-test-framework-grizzly2:jar:1.9:compile
[INFO] |  |  |     +- com.sun.jersey.jersey-test-framework:jersey-test-framework-core:jar:1.9:compile
[INFO] |  |  |     |  \- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] |  |  |     \- com.sun.jersey:jersey-grizzly2:jar:1.9:compile
[INFO] |  |  |        +- org.glassfish.grizzly:grizzly-http:jar:2.1.2:compile
[INFO] |  |  |        |  \- org.glassfish.grizzly:grizzly-framework:jar:2.1.2:compile
[INFO] |  |  |        |     \- org.glassfish.gmbal:gmbal-api-only:jar:3.0.0-b023:compile
[INFO] |  |  |        |        \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] |  |  |        +- org.glassfish.grizzly:grizzly-http-server:jar:2.1.2:compile
[INFO] |  |  |        |  \- org.glassfish.grizzly:grizzly-rcm:jar:2.1.2:compile
[INFO] |  |  |        +- org.glassfish.grizzly:grizzly-http-servlet:jar:2.1.2:compile
[INFO] |  |  |        \- org.glassfish:javax.servlet:jar:3.1:compile
[INFO] |  |  +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] |  |  +- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] |  |  +- org.apache.hadoop:hadoop-annotations:jar:2.2.0:compile
[INFO] |  |  |  \- jdk.tools:jdk.tools:jar:1.7:system
[INFO] |  |  \- io.netty:netty:jar:3.6.2.Final:compile
[INFO] |  \- org.apache.hadoop:hadoop-common:jar:2.2.0:compile
[INFO] |     +- com.google.guava:guava:jar:11.0.2:compile
[INFO] |     |  \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |     +- commons-cli:commons-cli:jar:1.2:compile
[INFO] |     +- org.apache.commons:commons-math:jar:2.1:compile
[INFO] |     +- xmlenc:xmlenc:jar:0.52:compile
[INFO] |     +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |     +- commons-codec:commons-codec:jar:1.4:compile
[INFO] |     +- commons-io:commons-io:jar:2.1:compile
[INFO] |     +- commons-net:commons-net:jar:3.1:compile
[INFO] |     +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] |     +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] |     +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] |     +- com.sun.jersey:jersey-core:jar:1.9:compile
[INFO] |     +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] |     |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |     |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |     |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] |     |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |     |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
[INFO] |     |  \- org.codehaus.jackson:jackson-xc:jar:1.8.3:compile
[INFO] |     +- tomcat:jasper-compiler:jar:5.5.23:runtime
[INFO] |     +- tomcat:jasper-runtime:jar:5.5.23:runtime
[INFO] |     +- javax.servlet.jsp:jsp-api:jar:2.1:runtime
[INFO] |     +- commons-el:commons-el:jar:1.0:runtime
[INFO] |     +- net.java.dev.jets3t:jets3t:jar:0.6.1:compile
[INFO] |     +- commons-lang:commons-lang:jar:2.5:compile
[INFO] |     +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |     |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |     |  +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |     |  |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |     |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |     +- org.apache.hadoop:hadoop-auth:jar:2.2.0:compile
[INFO] |     +- com.jcraft:jsch:jar:0.1.42:compile
[INFO] |     \- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] |        \- org.tukaani:xz:jar:1.0:compile
[INFO] +- com.linkedin.camus:camus-kafka-coders:jar:0.1.0-SNAPSHOT:compile
[INFO] |  +- kafka:kafka:jar:0.8-SNAPSHOT:compile
[INFO] |  |  \- com.github.sgroschupf:zkclient:jar:0.1:compile
[INFO] |  \- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] +- com.linkedin.camus:camus-schema-registry:jar:0.1.0-SNAPSHOT:compile
[INFO] \- com.linkedin.camus:camus-schema-registry-avro:jar:0.1.0-SNAPSHOT:compile
[INFO]    \- org.apache.avro:avro-repo-bundle:jar:1.7.4-SNAPSHOT:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

和我的pom.xml

 <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <!-- Spring dependencies -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring.version}</version>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring.version}</version>

    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring.version}</version>

    </dependency>

    <!-- Curiosity -->
    <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka_2.9.2</artifactId>
      <version>0.8.0</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.avro</groupId>
      <version>1.7.3</version>
      <artifactId>avro</artifactId>

    </dependency>

    <dependency>
      <groupId>org.apache.avro.repo</groupId>
      <version>1.7.5-1124-SNAPSHOT</version>
      <artifactId>avro-repo-bundle</artifactId>
    </dependency>

    <dependency>
      <groupId>com.linkedin.camus</groupId>
      <artifactId>camus-api</artifactId>
      <version>0.1.0-SNAPSHOT</version>

    </dependency>
    <dependency>
      <groupId>com.linkedin.camus</groupId>
      <artifactId>camus-kafka-coders</artifactId>
      <version>0.1.0-SNAPSHOT</version>

    </dependency>
    <dependency>
      <groupId>com.linkedin.camus</groupId>
      <artifactId>camus-schema-registry</artifactId>
      <version>0.1.0-SNAPSHOT</version>

    </dependency>
    <dependency>
      <groupId>com.linkedin.camus</groupId>
      <artifactId>camus-schema-registry-avro</artifactId>
      <version>0.1.0-SNAPSHOT</version>

    </dependency>

  </dependencies>

有没有人知道如何解决这个问题?

感谢您的帮助!

2 个答案:

答案 0 :(得分:0)

我不确定这个,但是传递依赖:

[INFO] |  |  +- org.eclipse.jetty:jetty-servlet:jar:8.1.8.v20121106:compile
例如,

非常适合这个问题。

你所得到的警告并不像你最初想的那样糟糕。可以安全地忽略它。

您可以通过在POM中排除类似*-servlet.jar

的传递依赖项来避免此警告

答案 1 :(得分:0)

它是在WAR中捆绑自己的servlet副本和JSP api引起的。查找servlet-api-*以及任何看似包装JSP API或工具的内容并将其排除。你有一些来自Jetty和javax.servlet。*组。您需要在上面看到的依赖项声明中手动输入排除项(<exclusions/>)。

这本身就是一个警告。但是,如果在单个容器中有多个程序,每个程序都带有这些程序包的不同版本,则可能会遇到问题。当它们失败时,弄清楚发生了什么事情真的很痛苦,因此查看已部署的应用程序并删除这些依赖项非常重要。

所以,这只是一个警告。之后,它可能会成为一个严重的部署问题,不会显示任何警告。