将项目拷到自己安装的TOMCAT(6.0)下运行就没有问题,用MYECLIPSE 6.5自带的TOMCAT调试运行时,就报404错误。 下面的控制台提示我看了下,主要是这个:严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.action.loginAction] for bean with name 'loginAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.action.loginAction说是找不到org.action.loginAction这个类。我仔细检查applicationContext.xml这个文件,没有发现错误,而且这个文件内容非常简单:
<?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 id="loginAction" class="org.action.loginAction"></bean></beans>请问是什么原因呢?

解决方案 »

  1.   

    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>你的web.xml 中配这个了吗?
      

  2.   

    自己安装的没问题 那就在myEclipse中配置自己安装的tomcat好了么
      

  3.   

    这个错意思就是在Tomcat下面没有找到.class文件
    (或有.class文件但版本低了,(不太可能))。
    至于为什么会这样,就猜不出来了。
      

  4.   

    我晕!   这是没监听啊!   你的提交什么的都没去截获,怎么才能处理啊!  缺少listener!
      

  5.   

    楼主在web.xml中加上Spring的Listener就行咯
      

  6.   

    这个是我的web.xml文件:<?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <filter>
       <filter-name>struts</filter-name>
       <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
      </filter>
      <filter-mapping>
       <filter-name>struts</filter-name>
       <url-pattern>/*</url-pattern>
      </filter-mapping>
      <listener>
       <listener-class>
       org.springframework.web.context.ContextLoaderListener
       </listener-class>
      </listener>
      <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>/WEB-INF/applicationContext.xml</param-value>
      </context-param>
    </web-app>
      

  7.   

    很奇怪啊,web.xml是按照教材配置的。org.action这个包也存在。
    而且如果是如此严重的问题,为什么在单独安装的TOMCAT就能运行,在MYECLIPSE自带的TOMCAT就处错误呢?
    两个都是6.0的TOMCAT
      

  8.   

    在单独安装的Tomcat中可以运行,Web应用就没有错。MyEclipse配置的问题罢了。换个Eclipse或高版本的My试试看