[jboss-user] [JBoss Messaging] - ClassLoader issue with user classes and JBM 1.0.1SP4

jcasp do-not-reply at jboss.com
Thu Feb 15 15:56:56 EST 2007


Hello,

I'm having some trouble migrating to JBoss Messaging 1.0.1SP4 from JBossMQ.  I'm running JBossAS 4.0.5GA.

The problem is when onMessage() is called in a JMS client in an ear.  I get a "java.lang.ClassNotFoundException: No ClassLoaders found for: <my class>".  That class is located in a jar within the ear.

I can instantiate the class elsewhere without a problem, so it's not a missing jar issue.  When the class is deserialized from the JMS ObjectMessage.getObject() method, the above-mentioned exception occurs:

  | public void onMessage(Message message) {
  |     try {
  |         ObjectMessage objectMessage = (ObjectMessage) message;
  |         DNSAMessage dnsaMessage = (DNSAMessage) objectMessage.getObject();
  | ...
  | 

I've read through the scoped classloader wiki docs, and even tried setting the ear to use the same loader-repository as jboss-messaging as suggested in other threads.  Predictably, if I copy the jar containing my userland class into jboss-messaging.sar, the class is found but a ClassCastException is thrown, because two separate classloaders are now trying to use the same classes.

I'm guessing since onMessage is called by a JBM thread, it uses JBM's classloader, hence the problem.  How should I configure JBM so that it doesn't try to load my userland classes?

Thank you for any ideas and help.
Justin

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017215#4017215

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017215



More information about the jboss-user mailing list