Bugs item #870942, was opened at 2004-01-05 08:54
Message generated for change (Comment added) made by swolfangel
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=870942&group_id=22866

Category: JBossMX
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Steve Wolfangel (swolfangel)
Assigned to: Scott M Stark (starksm)
Summary: Classloader problem with ear file

Initial Comment:
Hello,

I have an ear file that contains 2 stateless session 
beans and all the 3rd party jars required by the beans. 
The 3rd party jars contain older jdom classes than the 
jdom jar included in the jboss lib dir. I have a unique 
classloader setup (in the jboss-app.xml file) but I am 
having problems with jdom. It is finding the jboss jdom 
classes instead of the ones included in the ear. 

when I change the jboss-app.xml file to contain the 
following lines:

<jboss-app>
        <loader-repository>
                com.metamatrix:loader=MM.ear
                <loader-repository-
config>java2ParentDelegation=false</loader-repository-
config> 
        </loader-repository>
</jboss-app>

I get a NoClassDefFoundError. 

 java.lang.NoClassDefFoundError: java/sql/SQLException

This class is in the rt.jar file in the jdk!

I was under the impression that setting 
java2ParentDelegation to false meant that if the class 
was not found using the local classloader then the 
parent classloader would be called. 

In a nutshell, when I have java2ParentDelegation set to 
true, I get the jdom problem, when I have 
java2ParentDelegation set to false I am unable to see 
classes that are in the rt.jar file. 


Here is the output when starting the server.

[Server] Starting JBoss (MX MicroKernel)...
[Server] Release ID: JBoss [WonderLand] 3.2.3 (build: 
CVSTag=JBoss_3_2_3 date=200311301445)
[Server] Home Dir: D:\mm40\jb32\server\jboss
[Server] Home URL: file:/D:/mm40/jb32/server/jboss/
[Server] Library URL: file:/D:/mm40/jb32/server/jboss/lib/
[Server] Patch URL: null
[Server] Server Name: metamatrix
[Server] Server Home Dir: D:\mm40\jb32
\server\jboss\server\metamatrix
[Server] Server Home URL: 
file:/D:/mm40/jb32/server/jboss/server/metamatrix/
[Server] Server Data Dir: D:\mm40\jb32
\server\jboss\server\metamatrix\data
[Server] Server Temp Dir: D:\mm40\jb32
\server\jboss\server\metamatrix\tmp
[Server] Server Config URL: 
file:/D:/mm40/jb32/server/jboss/server/metamatrix/conf/
[Server] Server Library URL: 
file:/D:/mm40/jb32/server/jboss/server/metamatrix/lib/
[Server] Root Deployment Filename: jboss-service.xml
[Server] Starting General Purpose Architecture (GPA)...
[ServerInfo] Java version: 1.4.2,Sun Microsystems Inc.
[ServerInfo] Java VM: Java HotSpot(TM) Client VM 
1.4.2-b28,Sun Microsystems Inc.
[ServerInfo] OS-System: Windows XP 5.1,x86

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

>Comment By: Steve Wolfangel (swolfangel)
Date: 2004-01-06 10:39

Message:
Logged In: YES 
user_id=541224

Is there any thing else I can do to help troubleshoot this 
problem?  

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

Comment By: Steve Wolfangel (swolfangel)
Date: 2004-01-05 11:09

Message:
Logged In: YES 
user_id=541224

Attached log.zip file containing ucl.log and server.log

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

Comment By: Scott M Stark (starksm)
Date: 2004-01-05 10:40

Message:
Logged In: YES 
user_id=175228

Next step, add the following to the conf/log4j.xml and send me
the resulting server.log and ucl.log zipped up as the
ucl.log can
be large:

   <appender name="UCL" class="org.apache.log4j.FileAppender">

      <param name="File"
value="${jboss.server.home.dir}/log/ucl.log"/>
      <param name="Append" value="false"/>
      <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern"
value="[%r,%c{1},%t] %m%n"/>
      </layout>
   </appender>
   <category name="org.jboss.mx.loading" additivity="false">
      <priority value="TRACE" class="org.jboss.logging.XLevel"/>
      <appender-ref ref="UCL"/>

   </category>

[EMAIL PROTECTED]


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

Comment By: Scott M Stark (starksm)
Date: 2004-01-05 10:33

Message:
Logged In: YES 
user_id=175228

Yes, and there is a testcase in 3.2 for replacing the xml
parser with a different version of xerces for example, using
this approach. The problem with overriding the various xml
related classes is that these are used all over and not all
contexts are correctly limiting the scope of the classes
they use. Presumably this is the case for the jdom usage. 

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

Comment By: Steve Wolfangel (swolfangel)
Date: 2004-01-05 09:41

Message:
Logged In: YES 
user_id=541224

Replacing the jdom.jar file got me past this problem. I am still 
interested in finding the correct solution since there is a 
chance I could have similar problems in the future. 

Am I correct by assuming that by setting up my own 
classloader and setting java2ParentDelegation to false in the 
jboss-app file is the correct approach?

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

Comment By: Steve Wolfangel (swolfangel)
Date: 2004-01-05 09:25

Message:
Logged In: YES 
user_id=541224

I added the server.log file that contains the complete stack 
trace of the NoClassDefFound error. 

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

Comment By: Scott M Stark (starksm)
Date: 2004-01-05 09:19

Message:
Logged In: YES 
user_id=175228

The jdom.jar is only used by the XMBean parsing so as an
immeadiate workaround just replace the top lib/jdom.jar with
your version. 

Also, show the full stack trace for the NoClassDefFoundError
on lookup of SQLException. 

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

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


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to