2016-08-05 80 views
1

雖然試圖轉換彈簧應用springboot,我得到了以下錯誤試圖啓動應用程序:Springboot tomcat的:javax.servlet.ServletContext.addFilter

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] 
... 
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.addFilter(Ljava/lang/String;Ljavax/servlet/Filter;)Ljavax/servlet/FilterRegistration$Dynamic; 
at org.springframework.boot.web.servlet.AbstractFilterRegistrationBean.onStartup(AbstractFilterRegistrationBean.java:225) 
at org.springframework.boot.web.servlet.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:42) 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:229) 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:89) 
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:213) 
at org.springframework.boot.context.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:55) 
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5604) 
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
... 6 common frames omitted 

我試圖指定的Tomcat版本在POM:

<properties> 
    .... 
    <java.version>1.8</java.version> 
    <tomcat.version>7.0.70</tomcat.version> 
</properties> 

我也從春季開機起動父母繼承:

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.4.0.RELEASE</version> 
</parent> 

任何想法?

這裏是我的依賴關係:樹

xxx:yyy-integration-tests:jar:1.1.0-SNAPSHOT 
+- xxx:yyy-webapp:jar:classes:1.1.0-SNAPSHOT:compile 
| +- xxx:yyy-api:jar:1.1.0-SNAPSHOT:compile 
| | \- javax.validation:validation-api:jar:1.1.0.Final:compile 
| +- xxx:yyy-share:jar:1.1.0-SNAPSHOT:compile 
| | +- org.springframework:spring-context:jar:4.3.2.RELEASE:compile 
| | \- org.springframework.security:spring-security-acl:jar:4.1.1.RELEASE:compile 
| +- xxx:yyy-commons:jar:1.1.0-SNAPSHOT:compile 
| +- xxx.modules:yyy-modules-core:jar:1.1.0-SNAPSHOT:compile 
| | +- javax.mail:mail:jar:1.4.7:compile 
| | | \- javax.activation:activation:jar:1.1:compile 
| | +- org.springframework.data:spring-data-jpa:jar:1.10.2.RELEASE:compile 
| | | +- org.springframework.data:spring-data-commons:jar:1.12.2.RELEASE:compile 
| | | \- org.springframework:spring-orm:jar:4.3.2.RELEASE:compile 
| | +- org.springframework:spring-aspects:jar:4.3.2.RELEASE:compile 
| | \- joda-time:joda-time:jar:2.9.4:compile 
| +- xxx.modules:yyy-modules-contribution:jar:1.1.0-SNAPSHOT:compile 
| | \- commons-beanutils:commons-beanutils:jar:1.9.2:compile 
| +- xxx.modules:yyy-modules-search:jar:1.1.0-SNAPSHOT:compile 
| | \- org.antlr:antlr4-runtime:jar:4.2.1:compile 
| |  +- org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1:compile 
| |  \- org.antlr:antlr4-annotations:jar:4.2.1:compile 
| +- xxx.modules:yyy-modules-administration:jar:1.1.0-SNAPSHOT:compile 
| | +- zzz.ssacl:springsecurity-acl-nosql:jar:1.0.2:compile 
| | \- org.springframework.ldap:spring-ldap-core:jar:2.1.0.RELEASE:compile 
| +- xxx.modules:yyy-modules-dashboard:jar:1.1.0-SNAPSHOT:compile 
| +- xxx.thirdparty.marklogic:marklogic-datasource:jar:1.1.0-SNAPSHOT:runtime 
| | \- com.marklogic:marklogic-xcc:jar:8.0.1:runtime 
| +- xxx.thirdparty.ldap:module-auth-ldap:jar:1.1.0-SNAPSHOT:compile 
| | \- org.springframework.security:spring-security-ldap:jar:4.1.1.RELEASE:compile 
| +- zzz.ssacl:springsecurity-acl-marklogic:jar:1.0.2:runtime 
| | \- zzz.mltools:mltools:jar:1.0.5:runtime 
| +- xxx.thirdparty.lnfsie:lnfsie-wsclient:jar:1.1.0-SNAPSHOT:compile 
| | +- org.springframework.ws:spring-ws-test:jar:2.3.0.RELEASE:compile 
| | | \- xmlunit:xmlunit:jar:1.5:compile 
| | +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile 
| | | +- org.apache.httpcomponents:httpcore:jar:4.4.5:compile 
| | | \- commons-codec:commons-codec:jar:1.10:compile 
| | \- commons-collections:commons-collections:jar:3.2.2:compile 
| +- org.springframework:spring-webmvc:jar:4.3.2.RELEASE:compile 
| | \- org.springframework:spring-expression:jar:4.3.2.RELEASE:compile 
| +- org.springframework:spring-web:jar:4.3.2.RELEASE:compile 
| +- org.springframework:spring-context-support:jar:4.3.2.RELEASE:compile 
| +- org.springframework.security:spring-security-web:jar:4.1.1.RELEASE:compile 
| | \- aopalliance:aopalliance:jar:1.0:compile 
| +- org.springframework.security:spring-security-config:jar:4.1.1.RELEASE:compile 
| +- org.springframework.security:spring-security-taglibs:jar:4.1.1.RELEASE:compile 
| +- cglib:cglib-nodep:jar:2.2.2:compile 
| +- zzz.qqq:core-api:jar:1.0.5:compile 
| +- zzz.qqq:core-commons:jar:1.0.5:compile 
| +- zzz.qqq:core-web:jar:1.0.5:compile 
| | +- org.freemarker:freemarker:jar:2.3.25-incubating:compile 
| | +- javax.servlet:servlet-api:jar:2.5:compile 
| | +- commons-fileupload:commons-fileupload:jar:1.2.2:compile 
| | +- org.springframework:spring-jdbc:jar:4.3.2.RELEASE:compile 
| | +- org.springframework:spring-tx:jar:4.3.2.RELEASE:compile 
| | \- com.asual.lesscss:lesscss-engine:jar:1.4.2:compile 
| |  \- org.mozilla:rhino:jar:1.7R4:compile 
| +- org.springframework:spring-aop:jar:4.3.2.RELEASE:compile 
| +- org.aspectj:aspectjweaver:jar:1.8.9:compile 
| +- org.aspectj:aspectjrt:jar:1.8.9:compile 
| +- org.codehaus.janino:janino:jar:2.7.8:compile 
| | \- org.codehaus.janino:commons-compiler:jar:2.7.8:compile 
| +- com.thetransactioncompany:cors-filter:jar:1.7.1:compile 
| | \- com.thetransactioncompany:java-property-utils:jar:1.9:compile 
| \- net.sf.ehcache:ehcache-core:jar:2.6.6:runtime 
+- xxx:yyy-webapp:pom:1.1.0-SNAPSHOT:compile 
+- xxx:yyy-commons:test-jar:tests:1.1.0-SNAPSHOT:compile 
| +- org.springframework.security:spring-security-core:jar:4.1.1.RELEASE:compile 
| +- commons-io:commons-io:jar:2.4:compile 
| +- eu.medsea.mimeutil:mime-util:jar:2.1.3:compile 
| +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile 
| +- xml-resolver:xml-resolver:jar:1.2:compile 
| +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.1:compile 
| +- com.fasterxml.jackson.core:jackson-core:jar:2.3.1:compile 
| +- com.fasterxml.jackson.core:jackson-databind:jar:2.3.1:compile 
| \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.3.1:compile 
+- org.springframework.ws:spring-ws-core:jar:2.2.2.RELEASE:test 
| +- org.springframework.ws:spring-xml:jar:2.2.2.RELEASE:compile 
| +- org.springframework:spring-beans:jar:4.3.2.RELEASE:compile 
| +- org.springframework:spring-core:jar:4.3.2.RELEASE:compile 
| \- org.springframework:spring-oxm:jar:4.3.2.RELEASE:test 
+- org.springframework.boot:spring-boot-starter-web:jar:1.4.0.RELEASE:compile 
| +- org.springframework.boot:spring-boot-starter:jar:1.4.0.RELEASE:compile 
| | +- org.springframework.boot:spring-boot:jar:1.4.0.RELEASE:compile 
| | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.0.RELEASE:compile 
| | +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.0.RELEASE:compile 
| | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile 
| | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile 
| | \- org.yaml:snakeyaml:jar:1.17:runtime 
| +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.0.RELEASE:compile 
| | +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.70:compile 
| | +- org.apache.tomcat.embed:tomcat-embed-el:jar:7.0.70:compile 
| | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:7.0.70:compile 
| \- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile 
|  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile 
|  \- com.fasterxml:classmate:jar:1.3.1:compile 
+- org.apache.tomcat:tomcat-util:jar:7.0.70:runtime 
| +- org.apache.tomcat:tomcat-juli:jar:7.0.70:runtime 
| \- org.apache.tomcat:tomcat-api:jar:7.0.70:runtime 
|  \- org.apache.tomcat:tomcat-servlet-api:jar:7.0.70:runtime 
+- net.sf.saxon:Saxon-HE:jar:9.5.1-8:compile 
+- org.apache.commons:commons-lang3:jar:3.3.2:compile 
+- org.slf4j:slf4j-api:jar:1.7.21:compile 
+- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile 
+- org.springframework:spring-test:jar:4.3.2.RELEASE:compile 
+- junit:junit:jar:4.12:test 
+- org.hamcrest:hamcrest-core:jar:1.3:test 
+- org.hamcrest:hamcrest-library:jar:1.3:test 
+- org.mockito:mockito-core:jar:1.10.19:test 
| \- org.objenesis:objenesis:jar:2.1:test 
+- org.xmlunit:xmlunit-core:jar:2.0.0-alpha-03:test 
+- org.xmlunit:xmlunit-legacy:jar:2.0.0-alpha-03:test 
+- org.xmlunit:xmlunit-matchers:jar:2.0.0-alpha-03:test 
+- org.skyscreamer:jsonassert:jar:1.2.3:test 
| \- org.json:json:jar:20140107:test 
+- com.jayway.jsonpath:json-path:jar:0.8.1:test 
| +- net.minidev:json-smart:jar:1.1.1:test 
| \- commons-lang:commons-lang:jar:2.6:compile 
+- ch.qos.logback:logback-core:jar:1.1.7:test 
\- ch.qos.logback:logback-classic:jar:1.1.7:test 

任何想法?

回答

1

Spring Boot需要Servlet 3.0或更高版本。 zzz.qqq:core-web:jar:1.0.5對Servlet 2.5有依賴性。你應該更新你的pom以排除它。