Announcement Announcement Module
Collapse
No announcement yet.
ClassNotFoundException - How to get more debug info? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassNotFoundException - How to get more debug info?

    Hello,

    We are trying to build a commercial application using Spring Web Flow/Struts/Hibernate on Tomcat.

    I guess everyone here has encountered the "java.lang.ClassNotFoundException: java.lang.Exception" (see full stack trace below). Any error in the webflow.xml or your local flows seems to throw this error. The name of the "class not found" is never included in the error message.

    I've gotten used to using the "hit or miss" debugging method (comment stuff out until the error goes away), but there must be a better way. My current task is to install the "ContinuationFlowExecutionRepositoryFactory" in my webflow.xml. When I add the factory (using Phonebook example syntax) I get the ClassNotFoundException on startup. The codebase for our current application is simply too large to use the "hit or miss" approach.

    Is there a better way to debug Spring Web Flows? I have tried setting the log4j settings on the web flow classes ( e.g. log4j.category.org.springframework.webflow.executi on.repository=DEBUG, CONSOLE) without success.

    Can you catch exceptions from the flowExecutor and redirect the user to some reasonable behavior?

    Any help would be greatly appreciated,
    Thanks and Cheers,

    Mike Pastor



    2006-07-05 09:39:20 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
    java.lang.ClassNotFoundException: java.lang.Exception
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1340)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1189)
    at org.apache.struts.util.RequestUtils.applicationCla ss(RequestUtils.java:117)
    at org.apache.struts.util.RequestUtils.applicationIns tance(RequestUtils.java:143)
    at org.apache.struts.action.RequestProcessor.processE xception(RequestProcessor.java:529)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:421)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:224)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.ApplicationDispatcher.inv oke(ApplicationDispatcher.java:696)
    at org.apache.catalina.core.ApplicationDispatcher.pro cessRequest(ApplicationDispatcher.java:474)
    at org.apache.catalina.core.ApplicationDispatcher.doF orward(ApplicationDispatcher.java:409)
    at org.apache.catalina.core.ApplicationDispatcher.for ward(ApplicationDispatcher.java:312)
    at org.apache.struts.action.RequestProcessor.doForwar d(RequestProcessor.java:1062)
    at org.apache.struts.tiles.TilesRequestProcessor.doFo rward(TilesRequestProcessor.java:263)
    at org.apache.struts.action.RequestProcessor.processF orwardConfig(RequestProcessor.java:386)
    at org.apache.struts.tiles.TilesRequestProcessor.proc essForwardConfig(TilesRequestProcessor.java:318)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:229)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:292)
    at org.acegisecurity.intercept.web.FilterSecurityInte rceptor.invoke(FilterSecurityInterceptor.java:108)
    at org.acegisecurity.intercept.web.SecurityEnforcemen tFilter.doFilter(SecurityEnforcementFilter.java:19 7)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:303)
    at org.acegisecurity.providers.anonymous.AnonymousPro cessingFilter.doFilter(AnonymousProcessingFilter.j ava:143)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:303)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFi lter(AbstractProcessingFilter.java:246)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:303)
    at org.acegisecurity.context.HttpSessionContextIntegr ationFilter.doFilter(HttpSessionContextIntegration Filter.java:220)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:303)
    at org.acegisecurity.util.FilterChainProxy.doFilter(F ilterChainProxy.java:173)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter( FilterToBeanProxy.java:120)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)

  • #2
    Hi,

    You can start by working with logging while developing.
    Add a log statement as the first statement within in each method and at crucial locations within your code, to trace the execution of your program.
    Everytime you add new code make it a habit to also add the latter. You may always remove (comment) some later, after you have tested to your satisfaction.

    You can see, by analyzing the log file, between which log entries the exception was thrown.
    I myself add log entries to each method of my subclassed FormAction.

    Example 1:
    logger.info("-.-.> Executing initBinder()");

    Example 2:
    logger.info("-.-.> Calling MyMethod(String arg); arg='" + arg +"'");
    MyMethod(arg);
    logger.info("-.-.> Returning from calling MyMethod(String arg); arg='" + arg +"'");

    The "-.-.>" is to make it easy to see and trace in your log file.

    If you want to comment all those log statements at once use Grep. I recommend WinGrep if you develop in MSWindows.

    Comment


    • #3
      According to your stack trace that ClassNotFoundException was thrown by tomcat because the "java.lang.Exception" class could not be found, not by Spring or Spring Web Flow. It is indeed cryptic, but it looks to me like an environmental problem.

      If Spring tries to instantiate a bean whose class is not valid you will get a very descriptive BeanCreationException with a descriptive error message.

      You should be able to cut and paste the flow executor, flow registry, and continuation-based repository factory bean definitions from the phonebook sample into your own bean definition file. Spring IDE is also a big help with editing Spring bean definition files if you're using Eclipse, offering code completion on classnames as well as property names.

      Keith
      Last edited by Keith Donald; Jul 5th, 2006, 02:34 PM.

      Comment


      • #4
        Keith,

        Thanks for all of your help on the posts. We really appreciate it!

        I have an example of how Spring Web Flows throws the ClassNotFoundException. We recently implemented the ContinuationFlowExecutionRepository controller to deal with refresh/back button issues.

        We made all of the relevant model objects Serializable. Spring Web Flows threw good exceptions to point out the classes that we missed. However, a small aggregated class was missed. We saw the ClassNotFoundException whenever this small class was loaded into a Document (via Hibernate). No mention of the actual offending class was made in the log stacktrace. Really difficult to track on a big project.

        Can we catch these exceptions and make sure that they land in our application log (and not in Catalina.out) ? Is there an example Log4J properties file perhaps?


        Best Regards,
        Mike Pastor

        www.mikepastor.com

        Comment

        Working...
        X