当前位置: 首页 > 知识库问答 >
问题:

Spring MVC类突然找不到DispatcherServlet

毛勇
2023-03-14

我的WebApp正常工作,一切都很好,直到我尝试实现一些FileUpload。但这不起作用,所以我只是把一切恢复到以前的状态。但从那时起它就不起作用了。我的StackTrace:

Feb 11, 2014 4:11:35 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\java\jdk1.7.0_25\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files\Intel\DMIX;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\java\SlikSvn\bin;C:\java\apache-maven-3.0.5\bin;C:\java\apache-ant-1.8.4\bin;C:\java\SlikSvn\bin;C:\java\jdk1.7.0_25\bin;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files\Intel\DMIX;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\java\SlikSvn\bin;C:\Python27\Scripts;C:\Program Files (x86)\Google\google_appengine\;.
Feb 11, 2014 4:11:35 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:springproject' did not find a matching property.
Feb 11, 2014 4:11:36 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 11, 2014 4:11:36 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 521 ms
Feb 11, 2014 4:11:36 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 11, 2014 4:11:36 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Feb 11, 2014 4:11:36 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet ds as unavailable
Feb 11, 2014 4:11:36 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
  context: /springproject
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@139231a9
 org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Feb 11, 2014 4:11:36 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /springproject threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1128)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Feb 11, 2014 4:11:36 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 11, 2014 4:11:36 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 11, 2014 4:11:36 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/13  config=null
Feb 11, 2014 4:11:36 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 672 ms
Feb 11, 2014 4:11:42 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet ds is currently unavailable
Feb 11, 2014 4:11:43 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet ds is currently unavailable
Feb 11, 2014 4:11:44 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet ds is currently unavailable

我的pom.xml

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springproject</groupId>
<artifactId>springproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <warSourceDirectory>WebContent</warSourceDirectory>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
</build>


<dependencies>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.0.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>

    <!-- Spring JDBC -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.0.0.RELEASE</version>
    </dependency>
    <!-- H2 Driver -->
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.2.140</version>
    </dependency>

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20070829</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.9.13</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.9</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-web</artifactId>
        <version>3.2.0.RELEASE</version>
    </dependency>

</dependencies>
<?xml version="1.0" encoding="UTF-8"?>
<display-name>springproject</display-name>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/Application-context.xml</param-value>
</context-param>


<!-- Handles all requests into the application -->
<servlet>
    <servlet-name>ds</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/spring/servlets/servlet-context.xml
        </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>ds</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

共有1个答案

东门航
2023-03-14

如果您使用的是Eclipse,右键单击项目,转到Properties,然后在部署程序集上单击Add。->Java构建路径->Maven依赖项。单击“确定”,清除项目,然后重试。看看能不能用。

 类似资料:
  • (用户路径) D:\Program Files (x86)\Google\Google_AppEngine\lib\;C:\Python27\;C:\Python27\脚本\;D:\Program Files(x86)\Google\Google_AppEngine\ (系统路径) 我创建了一个PYTHONPATH变量: D:\Program Files(x86)\Google\Google_Ap

  • 我不确定我做了什么,但我似乎把我的项目搞砸了,因为它工作得很好,构建、编译等都没有问题,但现在构建过程给了我这个错误: 它的不同寻常之处在于,它引出了一个论点,我正在将它传递到一个图书馆类中,这个类是我编写的,并且已经在我几乎所有的项目中使用了近两年。 归结起来就是这个。。。库中的方法有如下两个参数: 我这样调用这个方法: 当我点击错误链接时,它直接跳到我传递到参数中的第一个数字。因此,因为它说如

  • 方法:获取 现状:404 注意:URL应该是http://localhost:8080/dragonline/resources/img/icon.png()

  • 几个月前,我在Windows10上创建了具有平均堆栈的web应用程序。然后我Rest了一下,现在我正努力重新开始。 当时我使用gulp、browsersync、webpack和nodemon来自动重启服务器,我记得一切正常。但是当我一周前尝试此功能时,它只是回答**“bash:gulp:command not found” 我在全球和本地卸载并重新安装了其他两个包,但没有区别。我决定尝试制作一个全

  • 本文向大家介绍idea启动springmvc项目时报找不到类的解决方法,包括了idea启动springmvc项目时报找不到类的解决方法的使用技巧和注意事项,需要的朋友参考一下 推荐阅读 idea官网下载链接(对应版本号下载): https://www.jetbrains.com/idea/download/other.html IDEA2020.2.2激活与IntelliJ IDEA2020注册码