org.springframework.web.servlet.DispatcherServlet 从 Spring 3



我正在将Web应用程序从Spring 3.0迁移到Spring 3.1。这些是我在pom中更改的缺点,对于我更改的每个依赖项<version>3.0.3.RELEASE</version> <version>3.1.4.RELEASE</version>

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-struts</artifactId>
  <version>3.1.4.RELEASE</version>
  <type>jar</type>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context-support</artifactId>
  <version>3.1.4.RELEASE</version>
  <type>jar</type>
  <scope>compile</scope>
  <exclusions>
    <exclusion>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
  </exclusion>
</exclusions>
</dependency>
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>3.1.4.RELEASE</version>
  <type>jar</type>
  <scope>compile</scope>
</dependency>

这是完整的pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
    <artifactId>giava_fe_inquiry-parent</artifactId>
    <groupId>res.dsa.soa2-giava</groupId>
    <version>1.0.0</version>
    <relativePath>../giava_fe_inquiry-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>res.dsa.soa2-giava</groupId>
<artifactId>giava_fe_inquiry-web</artifactId>
<packaging>war</packaging>
<version>0.0.2</version>
<name>${project.artifactId}</name>
<properties>
    <maven.test.skip>true</maven.test.skip>
    <project.build.sourceEncoding>windows-1252</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.adobe.blazeds</groupId>
        <artifactId>blazeds-core</artifactId>
        <version>3.2.0.3978</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.adobe.blazeds</groupId>
        <artifactId>blazeds-common</artifactId>
        <version>3.2.0.3978</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.adobe.blazeds</groupId>
        <artifactId>blazeds-proxy</artifactId>
        <version>3.2.0.3978</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.adobe.blazeds</groupId>
        <artifactId>blazeds-remoting</artifactId>
        <version>3.2.0.3978</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>res.dsa.soa2-giava</groupId>
        <artifactId>giava-core-ejb</artifactId>
        <version>1.0.64</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>res.dsa.soa2-giava</groupId>
        <artifactId>giava_backendinquiryclient-core</artifactId>
        <version>1.0.17</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>res.dsa.soa2-giava</groupId>
        <artifactId>giava_adobepdf_wsclient-core</artifactId>
        <version>1.0.2</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>itext</groupId>
        <artifactId>itext</artifactId>
        <version>1.3.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.netscape.sasl</groupId>
        <artifactId>capi-full-31-all14</artifactId>
        <version>1.0</version>
        <type>jar</type>
        <classifier>all14</classifier>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcmail-jdk15</artifactId>
        <version>1.45</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-ext-jdk15</artifactId>
        <version>1.45</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bctsp-jdk15</artifactId>
        <version>1.44</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.3</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>commons-fileupload</groupId>
        <artifactId>commons-fileupload</artifactId>
        <version>1.2.2</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.0</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.0.1</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.7.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>xml-apis</groupId>
        <artifactId>xml-apis</artifactId>
        <version>1.3.04</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>avalon-framework</groupId>
        <artifactId>avalon-framework-api</artifactId>
        <version>4.2.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.4</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>com.kenai.nbpwr</groupId>
        <artifactId>org-apache-batik-all</artifactId>
        <version>1.7-201003011305</version>
        <type>nbm</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>apache-xalan</groupId>
        <artifactId>serializer</artifactId>
        <version>2.7.0.patch02-brew</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-struts</artifactId>
        <version>3.1.4.RELEASE</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>res.dsa.soa2-giava</groupId>
        <artifactId>giava_violet_so_msg-core</artifactId>
        <version>1.0.5</version>
        <type>jar</type>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>SamlWas</artifactId>
                <groupId>res.dsa.bolina.libs</groupId>
            </exclusion>
            <exclusion>
                <artifactId>a2aModel-core</artifactId>
                <groupId>res.dsa.soa2-feed</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>net.java.dev.vcc.thirdparty</groupId>
        <artifactId>collection-setter-injector</artifactId>
        <version>0.5.0-1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>fop</artifactId>
        <version>1.0</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>xfire</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>2.0</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>org.jvnet.jaxb2_commons</groupId>
        <artifactId>jaxb2-commons-lang</artifactId>
        <version>2.3</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>3.1.4.RELEASE</version>
        <type>jar</type>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.flex</groupId>
        <artifactId>spring-flex-core</artifactId>
        <version>1.5.2.RELEASE</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.1.4.RELEASE</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>woodstox</groupId>
        <artifactId>wstx-asl</artifactId>
        <version>3.1.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.bitbucket.b_c</groupId>
        <artifactId>jose4j</artifactId>
        <version>0.6.2</version>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <finalName>giava_fe_inquiry-web</finalName>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
                <execution>
                    <id>npm-install</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>npm</executable>
                        <workingDirectory>${project.basedir}/src/main/ngapp</workingDirectory>
                        <arguments>
                            <argument>install</argument>
                        </arguments>
                    </configuration>
                </execution>
                <execution>
                    <id>npm-run-build</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>npm</executable>
                        <workingDirectory>${project.basedir}/src/main/ngapp</workingDirectory>
                        <arguments>
                            <argument>run</argument>
                            <argument>build</argument>
                            <argument>--base-href=./ng/</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <excludes>
                    <warSourceExcludes>ngapp/**</warSourceExcludes>
                </excludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <warSourceExcludes>ngapp/**</warSourceExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

我构建包并将其部署到服务器上。当我执行 servlet 调用时,我收到以下异常:

Error 404: javax.servlet.UnavailableException: SRVE0203E: Servlet [giava]: org.springframework.web.servlet.DispatcherServlet was found, but is missing another required class. SRVE0206E: This error typically implies that the servlet was originally compiled with classes which cannot be located by the server.

我的假设是有新的依赖要求,但哪些呢?

可能缺少一些依赖的 JAR,或者你已经用后来的 JDK 编译了你的类。你也可以检查系统输出,也许在那里你会发现缺少什么类。

找到了错误的依赖关系。搜索了该项目所依赖的其他项目的poms,并将所有springframework依赖项版本从3.0.3替换为3.1.4。

最新更新