SwiftMQ and JBoss 3.x class loading
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jason_Dillon
Posted On:   Monday, June 10, 2002 03:04 PM

Once again I am back to getting SwiftMQ to run as a service inside of JBoss. I have finished upgrading my app to JBoss 3.0 and have a new set of problems do deal with. I have written a SwiftMQRouterService, which is an JBoss Service MBean. It uses the SwiftletManager API to start the router via SwiftletManager.startRouter(configFilename). The problems that I am seeing with 3.0 are with the SwiftetManager not being able to see classes which are loaded from the JBoss UnifiedClassLoader (UCL) system: java.lang.NoClassDefFoundError: com/swiftmq/swiftlet/trace/TraceSwiftlet at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.j   More>>

Once again I am back to getting SwiftMQ to run as a service inside of JBoss. I have finished upgrading my app to JBoss 3.0 and have a new set of problems do deal with.


I have written a SwiftMQRouterService, which is an JBoss Service MBean. It uses the SwiftletManager API to start the router via SwiftletManager.startRouter(configFilename).


The problems that I am seeing with 3.0 are with the SwiftetManager not being able to see classes which are loaded from the JBoss UnifiedClassLoader (UCL) system:

			
java.lang.NoClassDefFoundError: com/swiftmq/swiftlet/trace/TraceSwiftlet
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at com.swiftmq.swiftlet.SwiftletManager.loadSwiftlet(SwiftletManager.java:653)
at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlets(SwiftletManager.java:202)
at com.swiftmq.swiftlet.SwiftletManager.initSwiftlets(SwiftletManager.java:621)
at com.swiftmq.swiftlet.SwiftletManager.startRouter(SwiftletManager.java:422)
at com.boldfish.does.router.SwiftMQRouterService.startService(SwiftMQRouterService.java:160)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
at java.lang.reflect.Method.invoke(Native Method)
... truncated ...



swiftmq.jar which contains TraceSwiftlet also contains SwiftetManager, which has definietly been loaded. Since there is no source available I can only guess that the problem is that SM is not using the TCL (Thread.getContextClassLoader()).


Note I am testing this with SwiftMQ 3.1.0, as I have not had time to update to 3.2.0 yet.


I would prefer to not put more classes on the system class path, as it makes it very hard to manage configurations and I have to put more than the SwiftMQ classes there, as it depends on other stuff like JSSE, which further muck up the config as I am then forced to move more and more to the system class path to avoid class loading issues.


Can you verify for me that the CL mechanism that SwiftletManager does not use TCL and if not can this be changed so that SwiftMQ can be run as a Service in JBoss with out having to hack up the class path for it?


Thanks,


--jason

   <<Less

Re: SwiftMQ and JBoss 3.x class loading

Posted By:   Andreas_Mueller  
Posted On:   Wednesday, June 12, 2002 01:21 AM


java.lang.NoClassDefFoundError: com/swiftmq/swiftlet/trace/TraceSwiftlet
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at com.swiftmq.swiftlet.SwiftletManager.loadSwiftlet(SwiftletManager.java:653)
at com.swiftmq.swiftlet.SwiftletManager.startKernelSwiftlets(SwiftletManager.java:202)
at com.swiftmq.swiftlet.SwiftletManager.initSwiftlets(SwiftletManager.java:621)
at com.swiftmq.swiftlet.SwiftletManager.startRouter(SwiftletManager.java:422)
at com.boldfish.does.router.SwiftMQRouterService.startService(SwiftMQRouterService.java:160)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:162)
at java.lang.reflect.Method.invoke(Native Method)
... truncated ...



The problem seems to be in the Kernel CL. It loads the TraceSwiftletImpl class which extends TraceSwiftlet. The latter is in swiftmq.jar. The Kernel CL knows all jars within the 'kernel/...' hierarchy. If it doesn't found a class, it falls back to the system class loader. Because you use another CL to load the swiftmq.jar, it doesn't found the TraceSwiftlet class. What you can try is to put the swiftmq.jar in each of the 'kernel' sub-dirs, e.g. in 'kernel/sys$trace', 'kernel/sys$jms' etc. Then the Kernel CL knows the swiftmq.jar too and it should work. Same with Extension Swiftlets (swiftmq.jar has to be in all 'deploy/router../xt$...' dirs).

Re: SwiftMQ and JBoss 3.x class loading

Posted By:   Andreas_Mueller  
Posted On:   Tuesday, June 11, 2002 12:43 AM

The core (everything from swiftmq.jar) is loaded by the system class loader. All Kernel Swiftlets are loaded by a Kernel class loader, each Extension Swiftlet is loaded by a separate class loader, because Extension Swiftlets are hot deployable. IMO, the only thing you have to do is to put the swiftmq.jar in your system class path.
About | Sitemap | Contact