使用struts的Web应用程序中的ClassNotFoundException

时间:2011-02-25 06:55:50

标签: exception java-ee struts classnotfoundexception struts-config

我正在使用Apache Struts开发一个Web应用程序,以部署在JBoss Server上。使用eclipse进行开发。

我已将web.xml配置为将所有* .do请求转发给ActionServlet。

JSP页面(abc.jsp)的表单为action =“newgoal.do”。

struts-config.xml文件包含以下条目:

 <action path="/newgoal" type="com.misys.trng.AddingNewGoalAction">
 </action>

我已经确认班级的路径是正确的。

我的网络应用程序中的所有其他.do转发工作正常。 当我从abc.jsp提交表单时,我得到以下异常:

2:13:43,793 ERROR [RequestProcessor] No action instance for path /newgoal could be created
java.lang.ClassNotFoundException: com.misys.trng.AddingNewGoalAction
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils.java:117)
at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)

我无法理解错误是什么。当其他所有其他工作正常时,为什么我的应用程序无法加载1个特定类。请帮忙。

2 个答案:

答案 0 :(得分:1)

该类必须存在于WEB-INF/classes下或位于WEB-INF/lib下的.jar文件中。确保它确实如此。

答案 1 :(得分:1)

也许某些事情在你的行动中是静止的?我有同样的问题。使用不存在的属性中的值初始化一个静态变量,然后不初始化操作。