Bugs item #606359, was opened at 2002-09-08 09:12
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=606359&group_id=22866

Category: JBossServer
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Wont Fix
Priority: 7
Submitted By: Michael Lipp (mlipp)
>Assigned to: Scott M Stark (starksm)
Summary: jboss-3.0.2 classloader bug

Initial Comment:
We are using jdom. jdom includes a class
org.jdom.outputXMLOutputter which has a nested class
org.jdom.output.XMLOutputter.NamespaceStack that is
derived from org.jdom.output.NamespaceStack.

jdom is made available to the ejbs with an entry
"Class-Path: lib/jdom-B8.jar" in the ejb's manifest.
The application is deployed as ear with jdom-B8.jar in
the lib/ subsection of the ear. This works.

Now we use jdom in a webapp as well. jdom is made
available as WEB-INF/lib/jdom-B8.jar (though this does
not matter, we use the default Java2 delegation). We
now use org.jdom.output.SAXOutputter in the web tier
(which has a nested class SAXOutputter.NamespaceStack
derived from org.jdom.outputNamespaceStack). Now using
XMLOutputter in the EJB results in an
"java.lang.IllegalAccessError: class
org.jdom.output.XMLOutputter$NamespaceStack cannot
access its superclass org.jdom.output.NamespaceStack".
This is a strong indication that the two classes use
different classloaders.

So we have inserted three classloader dump statements
(see appended file) and yes, if SAXOutputter is used in
the web layer first, we have the following situation:

EJBclass -> UnifiedClassLoader url=ejb.jar
org.jdom.output.XMLOutputter -> UnifiedClassLoader
url=ejb.jar
org.jdom.output.NamespaceStack -> UnifiedClassLoader
url=jdom-B8.jar

I didn't track things further down (I stopped when I
found that figure 2-3 - which should be part of the key
- in the (bought) docu is missing). But obviously
resolving NamespaceStack (as required by SAXOutputter)
in the web layer loads it through the jdom-B8.jar
loader and this association remains. Loading
XMLOutputter later in the ejb layer loads XMLOutputter
through the ejb's class loader but finds the already
loaded NamespaceStack with the associated jdom-B8.jar
loader.

>From the user perspective, I don't think we have done
anything wrong. Its a bug in the classloader
implementation (or even architecture).

----------------------------------------------------------------------

>Comment By: Scott M Stark (starksm)
Date: 2002-10-29 21:28

Message:
Logged In: YES 
user_id=175228

This problem occurs when either frameworks refuse to use 
the thread context class loader, or there are static references 
to classes in the duplicate jars from classes in different 
scopes. Either don't include the jdom-B8.jar multiple times, 
or use the servlet 2.3 class loading model.

----------------------------------------------------------------------

Comment By: Michael Lipp (mlipp)
Date: 2002-09-09 08:06

Message:
Logged In: YES 
user_id=77125

I have verified things (I needed  a workaround) by making
sure that whereever XMLOutputter is need, SAXOutputter is
loaded as well. Now things work (OK I could have added
jdom-B8.jar to the jboss classpath with -L but that would
have been too easy).

Maybe all this is just a duplicate to bug #602828. But while
the description there remains rather theoretical, it has
struck me as a real world problem.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=606359&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to