ClassNotFoundException in Web Application using struts

4.9k views Asked by At

I am developing a web application using Apache Struts, to be deployed on JBoss Server. Using eclipse for development.

I have configured web.xml to forward all *.do requests to ActionServlet.

A JSP page (abc.jsp) has a form with action="newgoal.do".

The struts-config.xml file has the following entry:

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

I have verified that the path of the class is correct.

All other .do forwards in my web application are working perfectly fine. When I submit the form from abc.jsp, I get the following exception:

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)

I cannot fathom what the error could be. Why isn't my application able to load 1 particular class, when all others are working fine. Please help.

2

There are 2 answers

2
Tommi On BEST ANSWER

The class must exist under WEB-INF/classes or be inside a .jar file under WEB-INF/lib. Make sure it does.

0
Luiz Henrique On

Perhaps something is static in your action? I had the same problem. One static variable was initialized with a value in properties that did not exist, then the action not is initialized.