JBoss Classloader (short) and (Character encoding??)

Lateef Jackson <[email protected]> Thu, 15 Jan 2004 16:46:59 -0500
Newsgroups gmane.comp.java.jpublish.devel
Organization Socialserve.com
Message-ID <[email protected]>
Basically I have two parts to this email. The first is from what I understand 
of the JBoss classloader which we have JPublish working except for hot 
deploy. The second part is about different character encodings in different 
war's.

1) JBoss classloader and JPublish:
As I explain this keep in mind that we have a couple different important 
pieces JBoss class loader, Jetty classloader and Servlet spec 2.4. (Jetty has 
a configuration that you can toggle so that it acts like 2.4 classloader spec 
we never got far enough to start messing with it by default it acts pre 2.4 
spec). 
In J2EE an application is deployed using an ear (enterpise application 
repository?) which is the top level classloader. All the sub classloaders 
(should) get the classes in this top level. Then you have war's and ejb's 
which are all seperate classloaders and they can access the ear classloader 
but not the ejb's or other wars classloaders in the ear. If you ask me it is 
amazing any of this works.
Where things get funky:
The war expects WEB-INF/lib to have all the jars in it that you are going to 
use in the war. Well we have 3 war's and it is just crazy to have it in three 
places!!! Not only does it start slower (JBoss is not speed machine to begin 
with) but jython processes the jar's 3 times!!!! So by using a MANIFEST.MF 
file in the war's META-INF directory you can keep most of your jar files in 
the ear's lib directory. However any classes you need to use in jython 
actions you _must_ put in the WEB-INF/lib directory. 
Not supprised the hot deploy doesn't work? Amazed anything works? 
Jython registry file:
Even though jython.jar is in the ear/lib directory you must create (touch) a 
file in the WEB-INF/lib/jython.jar even though it is an empty file you have 
to have it for the registy to work. Once you have placed that in there you 
then can place your 'registry' file in WEB-INF/lib directory. Are you sitting 
down couse this next part is really fun! If you have multiple war's in your 
ear only one of them will use the registry file. This is not in alphibetical 
order but it always uses the same war first (so far). In our build we copy 
the registry file to all the lib directories and touch the jython.jar so we 
won't get supprised if the order ever changes. All war's will have the same 
registry configurations. This is good for the cachedir parameter but if you 
need other parameters that are not global it might be a problem.
regisry files python.path:
We couldn't figure out how to get this working relativly. We had to put the 
full path to the jar file we wanted. This kinda suckes but with a little hack 
we have it working. It would be nice to find what this thinks the relative 
path is so we could make the deployment clean.

Finally:
I think this is what we know (pun intended). Eventually we should be able to 
get a cleaner build and figure out what the hotdeploy problem is and I can 
list the steps need to get JPublish working under JBoss.

2) Encoding problem: (Side note)
When I started this email we had a encoding issue. Basically here is the 
problem and I have fixed it for us, it might be classloader/jboss issue. But 
if you have different character encodings for different war's it really 
messes things up when you deploy it on JBoss. Just a note. I don't know if 
you tried a regular servlet server and had diffrent war's with separate 
character encodings in it but it might be worth a try.

Thanks for all your help.
LHJ




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn