HTTP Status 500 – Invalid action class configuration that references an unknown class named [logaction] type Exception report message Invalid action class configuration that references an unknown class named [logaction] description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [logaction] root cause 首先logaction这类有,struts.xml和app.xml的配置也对,登陆和注册访问它时正确,退出和修改访问时就出错。请大神指点 |
|
你访问的action 并不是 logaction ,可能你的action 重复写了。
|
|
10分 |
翻译过来就是
无效的动作类的配置,引用了一个命名为“logaction”的未知类 楼主能不能设一个断点或者设计log看看到底哪一个环节出的问题? |
我访问的action是logaction啊,你说的重写是什么意思 |
|
貌似不会设断点,因为登陆时访问的路径action=”${syspath}/app/logact_login”而注销时访问的路径是 ${syspath}/app/logact_logout,前面登陆成功了,这说明已经访问到logaction了,而后面注销就会出现上述错误,但myeclipse并没有报出异常 |
|
不是 重写 是重复 你看看你的action 名字 在你的配置文件里 出现了几次? |
|
哦已看,没有重复,代码如下: <action name="logact_*" class="logaction" method="{1}"> <result name="ok" type="redirect">/login.jsp?log=${log}</result> <result name="regist" type="redirect">/index.jsp</result> <result name="logout" >/index.jsp</result> <result name="update" >/information.jsp</result> </action> |
|
struts.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <constant name="objectFactory" value="spring"></constant> <package name="sys" extends="struts-default" abstract="true"> <global-results> <result type="redirect" name="index">/index.jsp</result> <result name="error">/error.jsp</result> </global-results> </package> <package name="app" extends="sys" namespace="/app"> <action name="logact_*" class="logaction" method="{1}"> <result name="ok" type="redirect">/login.jsp?log=${log}</result> <result name="regist" type="redirect">/index.jsp</result> <result name="logout" >/index.jsp</result> <result name="update" >/information.jsp</result> </action> <action name="orderact_*" class="orderAction" method="{1}"> <!--redirect 重定向 会丢失请求参数 dispatcher 是forword转发 --> <result name="index" type="redirect">/index.jsp</result> </action> <action name="caract_*" class="CarAction" method="{1}"> <!--redirect 重定向 会丢失请求参数 dispatcher 是forword转发 --> <result name="index" type="redirect">/index.jsp</result> </action> <action name="foodtypeact_*" class="foodtypeaction" method="{1}"> </action> </package> <package name="food" namespace="/food" extends="json-default"> <action name="foodAction_*" class="foodAction" method="{1}"> <result type="json"> <param name="noCache">true</param> <param name="ignoreHierarchy">false</param> </result> </action> <action name="foodtypeact_*" class="foodtypeaction" method="{1}"> <result type="json"> <param name="noCache">true</param> <param name="ignoreHierarchy">false</param> </result> </action> </package> </struts> |
|
配置文件出错了,不认识这个类,发下配置文件吧。
java.lang.RuntimeException: Invalid action class configuration that references an unknown class named [logaction] |
|
20分 |
我知道了,你不能把logaction直接放在src下 你建个包 把这个类丢里面。 |
application.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="c3p0dts" class="com.mchange.v2.c3p0.ComboPooledDataSource" > <property name="driverClass" value="com.mysql.jdbc.Driver"></property> <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/fastfood?useUnicode\=true&characterEncoding=UTF-8"></property> <property name="user" value="root"></property> <property name="password" value=""></property> <property name="maxPoolSize" value="100"></property> <property name="minPoolSize" value="20"></property> <property name="maxIdleTime" value="20000"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="c3p0dts"></property> <property name="mappingResources"> <list> <value>com/qrsx/bean/Userinfo.hbm.xml</value> <value>com/qrsx/bean/Province.hbm.xml</value> <value>com/qrsx/bean/City.hbm.xml</value> <value>com/qrsx/bean/Foodtype.hbm.xml</value> <value>com/qrsx/bean/Foodinfo.hbm.xml</value> <value>com/qrsx/bean/Foodcar.hbm.xml</value> <value>com/qrsx/bean/Orderinfo.hbm.xml</value> <value>com/qrsx/bean/Userlevel.hbm.xml</value> </list> </property> </bean> <!-- 实例化manager --> <bean id="foodmanager" class="com.qrsx.model.FoodManager"> <property name="mp"> <map> <entry key="1" value-ref="fooddao"></entry> <entry key="2" value-ref="userinfodao"></entry> <entry key="3" value-ref="orderdao"></entry> <entry key="4" value-ref="foodcardao"></entry> <entry key="5" value-ref="provincedao"></entry> <entry key="6" value-ref="citydao"></entry> <entry key="7" value-ref="foodtypedao"></entry> </map> </property> </bean> <bean id="sysdao" abstract="true"> <property name="sef" ref="sessionFactory"></property> </bean> <bean id="userinfodao" class="com.qrsx.dao.UserinfoDAO" parent="sysdao"></bean> <bean id="provincedao" class="com.qrsx.dao.ProvinceDAO" parent="sysdao"></bean> <bean id="citydao" class="com.qrsx.dao.CityDAO" parent="sysdao"></bean> <bean id="foodtypedao" class="com.qrsx.dao.FoodTypeDAO" parent="sysdao"></bean> <bean id="fooddao" class="com.qrsx.dao.FoodDAO" parent="sysdao"></bean> <bean id="foodcardao" class="com.qrsx.dao.FoodCarDAO" parent="sysdao"></bean> <bean id="orderdao" class="com.qrsx.dao.OrderDAO" parent="sysdao"></bean> <bean id="vhelper" class="com.qrsx.view.ViewHelper" scope="session"> <property name="manager" ref="foodmanager"></property> </bean> <!-- 由于设置bean定义中设置了abstract="true",因此它不能被容器实例化,只是在此起了模板的作用,供其他bean继承 --> <bean id="appactionsupport" class="com.qrsx.action.AppActionSupport" abstract="true" > <property name="manager" ref="foodmanager"></property> </bean> <bean id="logaction" class="com.qrsx.action.LogAction" scope="prototype" parent="appactionsupport"></bean> <bean id="orderAction" class="com.qrsx.action.orderAction" scope="prototype" parent="appactionsupport"></bean> <bean id="CarAction" class="com.qrsx.action.CarAction" scope="prototype" parent="appactionsupport"></bean> <bean id="foodtypeaction" class="com.qrsx.action.FoodTypeAction" scope="prototype" parent="appactionsupport"></bean> <bean id="foodAction" class="com.qrsx.action.FoodAction" scope="prototype" parent="appactionsupport"></bean> </beans> |
|
这个是在spring得管理下配置的,LogAction有自己的包 |
|
配置文件已发 |