代码之家  ›  专栏  ›  技术社区  ›  artaxerxe

无法为DispatcherServlet解析ClassNotFoundException(在Spring上)

  •  0
  • artaxerxe  · 技术社区  · 14 年前

    这是我的web.xml:

    <?xml version="1.0" encoding="UTF-8"?>
        <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
        <servlet>
            <servlet-name>spring-dispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>spring-dispatcher</servlet-name>
            <url-pattern>*.html</url-pattern>
        </servlet-mapping>
    </web-app>
    

    这是我的spring dispatcher servlet:

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd "> 
       <bean name="/hello-world.html" class="com.wiley.jfib.ch06.helloworld.service.HelloWorldService" /> 
    </beans>
    

    现在我的问题是,当我构建我的项目(使用Ant)时,它工作得很好,但是当我部署它时,我会得到一个错误:

    java.lang.ClassNotFoundException: >org.springframework.web.servlet.DispatcherServlet
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)....
    

    我的sproject structer展示如下:

      • 网址:com.wiley.jfib.ch06.helloworld.service
      • 网址:com.wiley.jfib.ch06.helloworld.service
      • WEB-INF
        • jsp公司
          • hello-world.jsp
        • 图书馆
          • jstl.jar、spring-webmvc.jar、spring.jar、standard.jar
        • web.xml,spring-dispatcher-servlet.xml

    为什么?

    1 回复  |  直到 10 年前
        1
  •  3
  •   Noam Nevo    14 年前

    在例外中也可以看到后,您还有多余的“>”