用struts2框架做的项目,错误500,大神帮我看下怎么解决

HTTPStatus500-typeExceptionreportmessagedescriptionTheserverencounteredaninternalerro... HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception Unable to instantiate Action, com.action.Empaction, defined for 'doinit_Emp' in namespace '/'com.action.Empaction
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:318)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
root cause java.lang.ClassNotFoundException: com.action.Empaction
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:157)
com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:107)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:160)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:120)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:299)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:399)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:198)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.
展开
 我来答
山水阿锐
推荐于2017-12-16 · TA获得超过34.3万个赞
知道顶级答主
回答量:23.7万
采纳率:91%
帮助的人:3.2亿
展开全部
首先检查在访问时是否写错了文件名称,如果无误,查看struts的xml文件是否配置有问题,没有问题,看以下文件的路径是放在webroot下还是放在了web-inf下,放在web-inf是不能直接访问的。只能通过action来访问。还有注意你是否使用了namespace!

你的配置文件明显是有问题的,在struts2中如果想要通过action访问.jsp的文件,那么需要在struts.xml中配置class路径,通过在地址栏中访问action获取连接方法和跳转的页面,举个例子:
<package name="emp" extends="struts-default">
<action name="empAction_*" method="{1}">
<result name="findAll">/WEB-INF/emplist.jsp</result>
<result name="toAdd">/WEB-INF/addEmp.jsp</result>
<result name="success" type="redirectAction">
<param name="actionName">empAction_findAll</param>
</result>
<result name="toUpdate">/WEB-INF/updateEmp.jsp</result>
</action>

</package>
class="com.xwj.oper.ac
追问

文件名称没问题 配置文件也没问题 jsp页面也在webroot目录下 namspace="/" 这样设置有什么问题吗 我把我的配置文件给你看

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式