将项目拷到自己安装的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>请问是什么原因呢?
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>请问是什么原因呢?
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>你的web.xml 中配这个了吗?
(或有.class文件但版本低了,(不太可能))。
至于为什么会这样,就猜不出来了。
<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>
而且如果是如此严重的问题,为什么在单独安装的TOMCAT就能运行,在MYECLIPSE自带的TOMCAT就处错误呢?
两个都是6.0的TOMCAT