I'm having a problem running a simple web app. I have an EAR file with the following contents:
utility.jar
webApp.war
/META-INF
application.xml
The utility.jar file contains common classes that can be used by any web application. The webApp.war file references classes contained in utility.jar, but when I try to access the web application, I get ClassNotFoundException's all over the place. I tried creating a /lib directory in the EAR and placed the utility.jar file in that directory thinking that it would be picked up by the EAR class loader, much in the same way WAR's work with /classes and /lib directories. Unfortunately, it doesn't work.
Now, I found out that if I place a simple
EJB in the EAR and specify the utility.jar in the EJB's manifest file, the web application works fine. Apparently the EJB forces the EAR class loader to find the utility.jar file which in turn makes it available to any WAR inside the EAR.
But what if you have an EAR that doesn't contain EJB's? How do you make JAR files containing a common codebase available to the WAR's inside the EAR?
I tried specifying a module in the EAR's application.xml file using the following format:
<module>
<
java>utility.jar</java>
</module>
But this doesn't work either. Any ideas?
Thanks,
SAF