Due to some requirement restrictions, the web application and the connector are packaged seperately - they cannot be packaged into a single EAR . Also these components needs to be self-contained, ie all the dependent JAR files need to be packaged inside these components and cannot be placed in the Server's classpath .
This is fine. The classes from the RAR file will still be available to the WAR deployement without having to re-package them with the WAR.
Since the RAR and the WAR code uses the ConenctionFactory I need to place the Connector JAR file inside both the RAR and the WAR.
Since the classloaders for RAR and the WAR are different I get a ClassCastException when I lookup the ConnectionFactory in the Web Application.
The reason for the CCE is that you are including the classes in *both* deployments. Remove these classes from the WAR. See above.
For the connector and the web application to be run on the Weblogic App. Server I can keep the Connector JAR file (containing the ConnectionFactory implementation) in both the RAR file and the JAR file and also set the
<enable-global-access-to-classes>true</enable-global-access-to-classes> in weblogic-ra.xml.
Effectively, this is accomplished in JBoss without having to specify anything beyond the defaults.
Thank you very much for your reply.
I had, in fact executed the JCA without the JAR files inside my WAR - it works fine. But, as I said, Weblogic dosent allow us to deploy the WAR file without the JAR file in its WEB-INF/lib folder. Since I need to maintain the same packaging for all the servers, it is causing the problem.
I would be really grateful if you could point me a way by which I can tell JBoss to merely ignore the JAR files included inside the WAR file - maybe using some deployment descriptor elements.
Appreciate your help greatly.
Thanks and Regards,
To do this you will need to change the default settings for Tomcat to use the JBossWebLoader by default and to use Parent2Child delegation. Since you didn not post what version of JBoss you are using I will assume JBoss 4.x. In your deploy directory you will see a directory
Navigate to the META-INF directory and locate the jboss-service.xml file. In this file you will see two attributes
<attribute name="Java2ClassLoadingCompliance">false</attribute> <attribute name="UseJBossWebLoader">false</attribute>
set both of these to true. This will force the WAR deployment to not use an isolated classloader.
Note, I don't really recommend doing this as it will effect every single WAR deployment in JBoss and pretty much violates the whole point of the WAR classloader to begin with. If you use Ant or some other automated build process the real solution would be to simply package your archives for your appropriate platform. Since this is simply a matter or excluding/including files, this would be the better approach.
Thanks a lot for giving this information!
If you use Ant or some other automated build process the real solution would be to simply package your archives for your appropriate platform. Since this is simply a matter or excluding/including files, this would be the better approach.We are in a situation where we are really stuck to the single package option.
But one final question - Is it possible to override the Java2ClassLoading policy on a single Web application basis. I assume there should be an equivalent file for the WAR (equivalent of jboss-service.xml) - but I could not find such an otpion in jboss-web.xml.
Again, thank you very much!
Unfortunately no. This is one of the 'benefits' to using an EAR as this can be done on a module by module basis without forcing all of your other deployments to use the same settings.