I am working on a web application in RAD 7 that is being built using the Struts v1.1 framework. I have two projects - let's call them projJava and projWeb. I have a JAR file containing some utility classes - called projUtility.jar - that has been added to the WEB-INF\lib folder in the projWeb project and is on the build path for both the projJava and projWeb projects. Everything compiles perfectly - there are no errors.
When I run the application, one of my Struts action classes fails when it attempts to import the class com.test.subtest.SecondChild. SecondChild is the child class of FirstChild which is the child class of the ParentOfChildren class. The exception is provided below.
------------ Exception forwarding for name firstAction: javax.servlet.ServletException: Error while defining class: com.test.subtest.SecondChild
This error indicates that the class: Error while defining class: com.test.subtest.FirstChild
This error indicates that the class: com.test.ParentOfChildren could not be located while defining the class: com.test.subtest.FirstChild
This is often caused by having the class at a higher point in the classloader hierarchy
Dumping the current context classloader hierarchy:
==> indicates defining classloader
*** indicates classloader where the missing class could have been found ------------
The SecondChild class and FirstChild class are located in the source folder of the projJava project. Their parent class - ParentOfChildren - is located in projUtility.jar which is on the build path for both the projJava and projWeb projects. The Struts actions are located in the JavaSource folder on the projWeb project.
If the Struts action class can see the classes FirstChild and SecondChild which are in the source folder of a completely different project - namely projJava - then why could their parent class, ParentOfChildren, not be loaded when it is in the projUtility.jar file which is on the build path of the project (projWeb) where the Struts action class is located?