Spring启动无法启动

时间:2015-06-01 07:40:32

标签: java servlets spring-boot

我开始弹簧靴,它给了我奇怪的例外。 控制台异常如下。

java.lang.NoSuchMethodError: javax.servlet.ServletContext.addFilter(Ljava/lang/String;Ljavax/servlet/Filter;)Ljavax/servlet/FilterRegistration$Dynamic;
at org.springframework.boot.context.embedded.FilterRegistrationBean.onStartup(FilterRegistrationBean.java:257) ~[spring-boot-1.2.2.RELEASE.jar:1.2.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:222) [spring-boot-1.2.2.RELEASE.jar:1.2.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:84) [spring-boot-1.2.2.RELEASE.jar:1.2.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:206) ~[spring-boot-1.2.2.RELEASE.jar:1.2.2.RELEASE]
...

我找到了方法ServletContext#addFilter,但异常一直说没有找到这样的方法。

有人能给我一些解决这个问题的方向吗? 提前谢谢。

的pom.xml

<?xml version="1com0" encoding="UTF-8"?>

xsi:schemaLocation="http://mavencomapachecomorg/POM/4com0com0
    http://mavencomapachecomorg/maven-v4_0_0comxsd">
<modelVersion>4com0com0</modelVersion>
<name>saki</name>
<groupId>comcomsaki</groupId>
<artifactId>saki-dot</artifactId>
<version>0com1com0</version>
<packaging>jar</packaging>

<properties>
    <jdkcomversion>1com8</jdkcomversion>
    <projectcombuildcomsourceEncoding>UTF-8</projectcombuildcomsourceEncoding>
    <sitecomencoding>UTF-8</sitecomencoding>
    <slf4jcomversion>1com7com7</slf4jcomversion>
    <logbackcomversion>1com0com13</logbackcomversion>
    <stormcomversion>0com9com4</stormcomversion>
    <saki-streamcomversion>0com6com5</saki-streamcomversion>
    <siddhicomversion>3com0com0-SNAPSHOT</siddhicomversion>
    <jacococomincludecompackage>acroumsashi.*</jacococomincludecompackage>
    <jacococomincludecompath>**/saki/**/*</jacococomincludecompath>
</properties>

<parent>
    <groupId>orgcomspringframeworkcomboot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1com2com2comRELEASE</version>
</parent>

<repositories>
    <repository>
        <id>wso2-releases</id>
        <name>WSO2 Releases</name>
        <url>http://mavencomwso2comorg/nexus/content/repositories/releases</url>
    </repository>
    <repository>
        <id>wso2-snapshot</id>
        <name>WSO2 Snapshot</name>
        <url>http://mavencomwso2comorg/nexus/content/repositories/snapshots</url>
    </repository>
</repositories>

<dependencies>
    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>orgcomhamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>orgcommockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1com9com5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>comcomh2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>comcomcocomtestcomsaki</groupId>
        <artifactId>saki-stream</artifactId>
        <version>${saki-streamcomversion}</version>
    </dependency>

    <dependency>
        <groupId>comcomcocomtestcomsaki</groupId>
        <artifactId>dot-stream</artifactId>
        <version>0com1com0</version>
        <exclusions>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>jetty</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javaxcomservlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>jetty-util</artifactId>
            </exclusion>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>orgcomapachecomstorm</groupId>
        <artifactId>storm-core</artifactId>
        <version>${stormcomversion}</version>
        <!-- Storm provided in runtime environment -->
        <exclusions>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>jetty</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javaxcomservlet</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>jetty-util</artifactId>
            </exclusion>
            <exclusion>
                <groupId>orgcommortbaycomjetty</groupId>
                <artifactId>servlet-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- Log -->
    <dependency>
        <groupId>orgcomslf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomslf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
    </dependency>
    <dependency>
        <groupId>chcomqoscomlogback</groupId>
        <artifactId>logback-classic</artifactId>
    </dependency>

    <!-- Spring Boot -->
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>orgcomspringframeworkcomboot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomthymeleafcomextras</groupId>
        <artifactId>thymeleaf-extras-springsecurity3</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomspringframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomthymeleaf</groupId>
        <artifactId>thymeleaf-spring4</artifactId>
    </dependency>
    <dependency>
        <groupId>javaxcommail</groupId>
        <artifactId>mail</artifactId>
        <version>1com4</version>
    </dependency>


    <dependency>
        <groupId>orgcomapachecomcommons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3com3com2</version>
    </dependency>

    <dependency>
        <groupId>comcomgooglecomguava</groupId>
        <artifactId>guava</artifactId>
        <version>17com0</version>
    </dependency>

    <!-- ScalaCompiler -->
    <dependency>
        <groupId>orgcomscala-lang</groupId>
        <artifactId>scala-compiler</artifactId>
        <version>2com10com4</version>
    </dependency>

    <dependency>
        <groupId>orgcomfreemarker</groupId>
        <artifactId>freemarker</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2com4</version>
    </dependency>

    <!-- jdbc driver -->
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomxerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3com8com7</version>
    </dependency>
    <dependency>
        <groupId>orgcomspringframeworkcomboot</groupId>
        <artifactId>spring-boot-starter-jta-bitronix</artifactId>
    </dependency>

    <dependency>
        <groupId>orgcomspringframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
        <groupId>orgcomapachecomhttpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4com4com1</version>
    </dependency>
    <dependency>
        <groupId>orgcomspringframework</groupId>
        <artifactId>spring-webmvc-portlet</artifactId>
    </dependency>
</dependencies>


<build>
    <finalName>${projectcomartifactId}-${projectcomversion}</finalName>
    <!-- ソースコードのルートパスの指定 -->
    <sourceDirectory>src/main/java</sourceDirectory>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>
    <!-- テストコードのルートパスの指定 -->
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <testResources>
        <testResource>
            <directory>src/test/resources</directory>
        </testResource>
    </testResources>
    <defaultGoal>validate</defaultGoal>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>orgcomspringframeworkcomboot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>orgcomapachecommavencomplugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2com3com2</version>
                <configuration>
                    <source>${jdkcomversion}</source>
                    <target>${jdkcomversion}</target>
                    <encoding>${projectcombuildcomsourceEncoding}</encoding>
                    <failOnError>true</failOnError>
                    <fork>true</fork>
                    <compilerArgument>-nowarn</compilerArgument>
                </configuration>
            </plugin>
            <plugin>
                <groupId>orgcomapachecommavencomplugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3com3</version>
                <configuration>
                    <locales>ja</locales>
                    <inputEncoding>${projectcombuildcomsourceEncoding}</inputEncoding>
                    <outputEncoding>${sitecomencoding}</outputEncoding>
                </configuration>
            </plugin>

            <!--This plugin's configuration is used to store Eclipse m2e settings 
                onlycom It has no influence on the Maven build itselfcom -->
            <plugin>
                <groupId>orgcomeclipsecomm2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1com0com0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>orgcomjacoco</groupId>
                                    <artifactId>jacoco-maven-plugin</artifactId>
                                    <versionRange>[0com5,)
                                    </versionRange>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <!-- m2e doesn't know what to do with jacoco, let's ignore it or 
                                        annoying error markers appear see http://wikicomeclipsecomorg/M2E_plugin_execution_not_covered -->
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
                <source>${jdkcomversion}</source>
                <encoding>${projectcombuildcomsourceEncoding}</encoding>
                <docencoding>${sitecomencoding}</docencoding>
                <charset>${sitecomencoding}</charset>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>orgcomjacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>prepare-agent</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <propertyName>jacocoArgs</propertyName>
                        <includes>
                            <include>*</include>
                        </includes>
                    </configuration>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>${jacocoArgs}</argLine>
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomspringframeworkcomboot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>sakicomdotcomApplication</mainClass>
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomspringframeworkcomboot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <dependencies>
                <dependency>
                    <groupId>orgcomspringframework</groupId>
                    <artifactId>springloaded</artifactId>
                    <version>1com2com1comRELEASE</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2com2-beta-5</version>
            <configuration>
                <finalName>${projectcomname}</finalName>
                <descriptors>
                    <descriptor>src/main/assembly/distributioncomxml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>


<reporting>
    <plugins>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2com6</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                        <report>summary</report>
                        <report>project-team</report>
                        <report>plugin-management</report>
                        <report>plugins</report>
                        <!-- report>dependencies</report -->
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-jxr-plugin</artifactId>
            <version>2com3</version>
            <configuration>
                <inputEncoding> ${projectcombuildcomsourceEncoding} </inputEncoding>
                <outputEncoding>${sitecomencoding}</outputEncoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2com9</version>
            <configuration>
                <source>${jdkcomversion}</source>
                <encoding>${projectcombuildcomsourceEncoding}</encoding>
                <docencoding>${sitecomencoding}</docencoding>
                <charset>${sitecomencoding}</charset>
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2com12</version>
            <configuration>
                <encoding>${projectcombuildcomsourceEncoding}</encoding>
                <configLocation>${projectcombasedir}/dev/checkstylecomxml</configLocation>
                <!-- <includes>**/*.java</includes> <excludes>**/stub/**/*.java, **/Test*.java</excludes> -->
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>3com1</version>
            <configuration>
                <sourceEncoding>${projectcombuildcomsourceEncoding}</sourceEncoding>
                <targetJdk>${jdkcomversion}</targetJdk>
                <!-- <includes> <include>**/*foocomjava</include> </includes> <excludes> 
                    <exclude>**/barcomjava</exclude> </excludes> <excludeRoots> <excludeRoot>src/main/java/stubs</excludeRoot> 
                    </excludeRoots> -->
            </configuration>
            <reportSets>
                <reportSet>
                    <reports>
                        <!-- report>pmd</report -->
                        <report>cpd</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
        <plugin>
            <groupId>orgcomcodehauscommojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3com0com0</version>
            <configuration>
                <!-- includeFilterFile>${basedir}/findbugs-includecomxml</includeFilterFile -->
                <excludeFilterFile>${basedir}/dev/findbugs-excludecomxml</excludeFilterFile>
                <xmlOutput>true</xmlOutput>
                <failOnError>false</failOnError>
                <!-- High|Normal|Low|Exp|Ignore -->
                <threshold>Normal</threshold>
                <!-- Min|Default|Max -->
                <effort>Default</effort>
                <sourceEncoding>${projectcombuildcomsourceEncoding}</sourceEncoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>orgcomapachecommavencomplugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2com14com1</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>report-only</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
        <plugin>
            <groupId>orgcomjacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
                <includes>
                    <include>${jacococomincludecompath}</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</reporting>

0 个答案:

没有答案