Hi, I have a Web Project that uses struts. The project needs to access a common java project containing a class that serves as an error handler (ErrorHandler.java). The ErrorHandler class is instantiated from an Action class in the web project. The ErrorHandler has a method getErrors() which returns an ActionErrors object. I have placed struts.jar in WEB-INF/lib of the web project and included struts.jar in the classpath for the Java project containing ErrorHandler.java. I have also linked the Java project to the web application. Though the ErrorHandler class compiles correctly, a 'java.lang.NoClassDefFoundError: org/apache/struts/action/ActionErrors' is thrown at runtime when the getErrors() method is called. If ErrorHandler.java is made part of the web project it works fine. The 'NoClassDef found' error occurs only when it is moved out into a separate Java Project. Is there a specific configuration in WSAD5 that can help me run my application when the ErrorHandler is moved out into a separate Java Project? Thanks.
On the project properties, select Web Library Projects. Click Add, create a jar name, and select the project containing your error handler. The other possibility is that one (or both) of the struts.jar files is corrupted. Check their sizes, then check them against one that you know is good. I've seen this happen and cause similar errors in the past.
"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Is that a spider in your hair? Here, threaten it with this tiny ad: