You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sgoyette <st...@goyettefamily.com> on 2006/07/06 01:30:52 UTC

NoClassDefFoundError ActiveMQConnectionFactory

Hi,

I'm trying to setup a connection to the broker using this code:

     connectionFactory = new ActiveMQConnectionFactory(
"tcp://localhost:61616" );
     connection = connectionFactory.createTopicConnection();
     connection.start();

What's happening is that I'm getting the NoClassDefFound exception being
thrown on the first line.  The libraries (all of the libraries) in the lib
directory are in my classpath so I'm a bit confused as to why this would
happen.

Has anyone run in to this?  Any ideas?  There really isn't a lot more to
say...this is really simple but for some reason it's just not working.

Any help would be greatly appreciated.

Steve
-- 
View this message in context: http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5191481
Sent from the ActiveMQ - User forum at Nabble.com.


Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by sgoyette <st...@goyettefamily.com>.
Hi,

If I add the incubator-activemq-4.0.1.jar to the orion/lib directory then
yes this will allow me to get past this specific error...unfortunately it
causes other problems and isn't really an optimal way to go.

The problem I run into when doing this is that I wrap my specific message
objects inside of an ObjectMessage and when I attempt to get the object from
the message deserialization fails with:

javax.jms.JMSException: Failed to build body from bytes. Reason:
java.io.IOException: ca.intuit.jms.message.LoginMessage

This is a very non-informative message as it's really wrapping a
ClassNotFoundException and then throwing the IOException.  When I trace into
the source this is the root cause of this specific issue:

java.lang.ClassNotFoundException: ca.intuit.jms.message.LoginMessage

So it would seem that the class loader on the ActiveMQ side of things
doesn't know anything about the LoginMessage object that the message
contains.  I would think this is specifically related to the fact that the
ActiveMQ jar file is being loaded inside of the Orion container.

So I'm not sure what to do from here.  

I tried making sure that the backport-util-concurrent jar is being included
and when I look through things the root exception is :
java.lang.NoClassDefFoundError:
org/apache/activeio/util/ByteArrayInputStream
but as per the previous class path dump the library (activeio-core) is in
there and still is.

Any other ideas?  I really appreciate any and all pointers you or anyone
might have.

Thanks,

Steve


-- 
View this message in context: http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5225493
Sent from the ActiveMQ - User forum at Nabble.com.


Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by Sanjiv Jivan <sa...@gmail.com>.
Seems like a classloader issue. The class trying to load the active mq
classes seem to be loaded in a parent classloader is has changed the thread
context classloader and not reset it correctly.

Try
1) Adding the active mq jars in the bootclasspath of your orion server
2) If 1) doesn't work, Try adding the active mq jars in the jre/lib/ext
directory.

Not suggesting that you use this as a permanent solution, but just a few
things to try in order to narrow down the issue.

If none of the above solutions work, fire up your debugger and set break
points and examine

1) Thread#getContextClassLoader() and
2) ca.quicktax.web.servlet.Administration.class.getClassLoader() ,
ca.intuit.jms.MessageDispatcher.class.getClassLoader()

Good luck!

Sanjiv


On 7/6/06, sgoyette <st...@goyettefamily.com> wrote:
>
>
> Hi,
>
> That class just provides an abstraction layer.  It's derived from another
> class named JMSConnection and has a sibling named JMSQueue.  There really
> isn't much in either one at this point and removing them to provide a
> simpler path to aid in diagnostics hasn't really helped so far.
>
> I tried replacing the jars as per your comment and got the exact same
> error.
> The fact that printing out the classpath at the time of the exception
> shows
> that the jars are there is making me a tad frustrated.  There must be a
> dependancy that isn't being met but I'll be darned if I can find it.
>
> Steve
> --
> View this message in context:
> http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5204129
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>

Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by sgoyette <st...@goyettefamily.com>.
Hi,

That class just provides an abstraction layer.  It's derived from another
class named JMSConnection and has a sibling named JMSQueue.  There really
isn't much in either one at this point and removing them to provide a
simpler path to aid in diagnostics hasn't really helped so far.

I tried replacing the jars as per your comment and got the exact same error. 
The fact that printing out the classpath at the time of the exception shows
that the jars are there is making me a tad frustrated.  There must be a
dependancy that isn't being met but I'll be darned if I can find it.

Steve
-- 
View this message in context: http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5204129
Sent from the ActiveMQ - User forum at Nabble.com.


Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by James Strachan <ja...@gmail.com>.
On 7/6/06, sgoyette <st...@goyettefamily.com> wrote:
>
> I'm using version 4.0.1.
>
> Here's the stack dump:
>
> java.lang.NoClassDefFoundError:
> org/apache/activemq/ActiveMQConnectionFactory
>         at ca.intuit.jms.JMSTopic.createConnection(JMSTopic.java:81)

I've no idea what this class is - any idea what its doing?

One idea is to use the activemq-4.0.1.jar instead of activeio and
activemq-core which includes all the dependencies you need in case you
forget something (such as a JMS/J2EE jar etc)
-- 

James
-------
http://radio.weblogs.com/0112098/

Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by Sanjiv Jivan <sa...@gmail.com>.
Just reread your message and noticed that you got a NoClassDefFoundError,
and not a ClassNotFoundException. What NoClassDefFoundError means is that
the JVM's clasloader  *has* found the class however wasnt able to load the
definition of the class. This typically happens when the class has some
static code relying on some other library that does not exist in the
classpath.

Looking at the source of ActiveMQConnectionFactory, the possible missing
jars from the classpath is backport-util-concurrent.jar:

static protected final Executor DEFAULT_CONNECTION_EXECUTOR = new *
ScheduledThreadPoolExecutor*(5, new ThreadFactory() {
            public Thread newThread(Runnable run) {
                Thread thread = new Thread(run);
                thread.setPriority(
ThreadPriorities.INBOUND_CLIENT_CONNECTION);
                return thread;
            }
        });


Sanjiv

On 7/6/06, sgoyette <st...@goyettefamily.com> wrote:
>
>
> I'm using version 4.0.1.
>
> Here's the stack dump:
>
> java.lang.NoClassDefFoundError:
> org/apache/activemq/ActiveMQConnectionFactory
>        at ca.intuit.jms.JMSTopic.createConnection(JMSTopic.java:81)
>        at ca.intuit.jms.JMSConnection.getSession(JMSConnection.java:124)
>        at ca.intuit.jms.JMSTopic.setListener(JMSTopic.java:146)
>        at ca.intuit.jms.JMSSubSystem.setListener(JMSSubSystem.java:179)
>        at ca.intuit.jms.MessageDispatcher.<init>(MessageDispatcher.java
> :62)
>        at
> ca.intuit.jms.MessageDispatcher.<clinit>(MessageDispatcher.java:50)
>        at
> ca.quicktax.web.servlet.Administration.initJms(Administration.java:819)
>        at
> ca.quicktax.web.servlet.Administration.sessionDestroyed(
> Administration.java:887)
>        at com.evermind._ay._hsb(Unknown Source)
>        at com.evermind._eu._hsb(Unknown Source)
>        at com.evermind._hc._hsb(Unknown Source)
>        at com.evermind._hc.run(Unknown Source)
>        at com.evermind._bd.run(Unknown Source)
>        at com.evermind._bf.run(Unknown Source)
>
> This is what's at line 81 of JMSTopic:
>
> connectionFactory = new ActiveMQConnectionFactory( "tcp://localhost:61616"
> );
>
> It really does look like it can't find the jar file but they're definately
> in the classpath.  I've included:
>
> activeio-core-3.0-beta3.jar
> activemq-core-4.0.1.jar
> commons-logging-1.0.4.jar
>
> At various times I've tried including everything in the lib directory as
> well as everything in the optional directory (was grasping at that point).
>
> this is running on Java HotSpot(TM) Client VM version 1.5.0_03-b07 and
> sits
> inside Orion 2.0.5
>
> Here's what's in my classpath at the time of the exception (via
> system.properties):
>
> /usr/local/orion/orion.jar
> /usr/local/orion/ejb.jar
> /usr/local/orion/activation.jar
> /usr/local/orion/jdbc.jar
> /usr/local/orion/jndi.jar
> /usr/local/orion/jta.jar
> /usr/local/orion/mail.jar
> /usr/local/orion2.0.5/lib
> /usr/local/orion2.0.5/lib/hsqldb.jar
> /usr/local/orion2.0.5/lib/classes12.jar
> /usr/local/orion2.0.5/lib/ojdbc14.jar
> /usr/local/orion2.0.5/lib/p6spy.jar
> /var/local/apps/06/config/orion/lib
> /var/local/apps/06/j2ee-apps/applications/web/log4j-1.2.8.jar
> /var/local/apps/06/j2ee-apps/applications/web/velocity-1.4.jar
> /var/local/apps/06/j2ee-apps/applications/web/velocity-dep-1.4.jar
> /var/local/apps/06/j2ee-apps/applications/web/axis.jar
> /var/local/apps/06/j2ee-apps/applications/web/wsdl4j.jar
> /var/local/apps/06/j2ee-apps/applications/web/jaxrpc.jar
> /var/local/apps/06/j2ee-apps/applications/web/saaj.jar
> /var/local/apps/06/j2ee-apps/applications/web/commons-beanutils-1.6.1.jar
> /var/local/apps/06/j2ee-apps/applications/web/commons-discovery.jar
> /var/local/apps/06/j2ee-apps/applications/web/commons-collections-3.0.jar
> /var/local/apps/06/j2ee-apps/applications/web/cglib-full-2.0.2.jar
> /var/local/apps/06/j2ee-apps/applications/web/commons-lang-1.0.1.jar
> /var/local/apps/06/j2ee-apps/applications/web/dom4j-1.4.jar
> /var/local/apps/06/j2ee-apps/applications/web/ehcache-0.9.jar
> /var/local/apps/06/j2ee-apps/applications/web/hibernate2.jar
> /var/local/apps/06/j2ee-apps/applications/web/hibernate-tools.jar
> /var/local/apps/06/j2ee-apps/applications/web/jdom.jar
> /var/local/apps/06/j2ee-apps/applications/web/jta.jar
> /var/local/apps/06/j2ee-apps/applications/web/odmg-3.0.jar
> /var/local/apps/06/j2ee-apps/applications/web/sso_client.jar
> /var/local/apps/06/j2ee-apps/applications/web/intuit-shared.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/log4j-
> 1.2.8.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-
> logging-api-1.0.3.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/cos-
> 31oct2000.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/activeio-
> core-3.0-beta3.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-
> discovery.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/velocity-
> dep-1.4.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-
> beanutils-1.6.1.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/activemq-
> core-4.0.1.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-
> logging-1.0.4.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-
> collections-3.0.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/jakarta-
> regexp-1.2.jar
>
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/sso_client.jar
> /var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/velocity-
> 1.4.jar
>
> What am I missing?
>
> Steve
> --
> View this message in context:
> http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5202922
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>

Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by sgoyette <st...@goyettefamily.com>.
I'm using version 4.0.1.

Here's the stack dump:

java.lang.NoClassDefFoundError:
org/apache/activemq/ActiveMQConnectionFactory
        at ca.intuit.jms.JMSTopic.createConnection(JMSTopic.java:81)
        at ca.intuit.jms.JMSConnection.getSession(JMSConnection.java:124)
        at ca.intuit.jms.JMSTopic.setListener(JMSTopic.java:146)
        at ca.intuit.jms.JMSSubSystem.setListener(JMSSubSystem.java:179)
        at ca.intuit.jms.MessageDispatcher.<init>(MessageDispatcher.java:62)
        at
ca.intuit.jms.MessageDispatcher.<clinit>(MessageDispatcher.java:50)
        at
ca.quicktax.web.servlet.Administration.initJms(Administration.java:819)
        at
ca.quicktax.web.servlet.Administration.sessionDestroyed(Administration.java:887)
        at com.evermind._ay._hsb(Unknown Source)
        at com.evermind._eu._hsb(Unknown Source)
        at com.evermind._hc._hsb(Unknown Source)
        at com.evermind._hc.run(Unknown Source)
        at com.evermind._bd.run(Unknown Source)
        at com.evermind._bf.run(Unknown Source)

This is what's at line 81 of JMSTopic:

connectionFactory = new ActiveMQConnectionFactory( "tcp://localhost:61616"
); 

It really does look like it can't find the jar file but they're definately
in the classpath.  I've included:

activeio-core-3.0-beta3.jar
activemq-core-4.0.1.jar
commons-logging-1.0.4.jar

At various times I've tried including everything in the lib directory as
well as everything in the optional directory (was grasping at that point).

this is running on Java HotSpot(TM) Client VM version 1.5.0_03-b07 and sits
inside Orion 2.0.5

Here's what's in my classpath at the time of the exception (via
system.properties):

/usr/local/orion/orion.jar
/usr/local/orion/ejb.jar
/usr/local/orion/activation.jar
/usr/local/orion/jdbc.jar
/usr/local/orion/jndi.jar
/usr/local/orion/jta.jar
/usr/local/orion/mail.jar
/usr/local/orion2.0.5/lib
/usr/local/orion2.0.5/lib/hsqldb.jar
/usr/local/orion2.0.5/lib/classes12.jar
/usr/local/orion2.0.5/lib/ojdbc14.jar
/usr/local/orion2.0.5/lib/p6spy.jar
/var/local/apps/06/config/orion/lib
/var/local/apps/06/j2ee-apps/applications/web/log4j-1.2.8.jar
/var/local/apps/06/j2ee-apps/applications/web/velocity-1.4.jar
/var/local/apps/06/j2ee-apps/applications/web/velocity-dep-1.4.jar
/var/local/apps/06/j2ee-apps/applications/web/axis.jar
/var/local/apps/06/j2ee-apps/applications/web/wsdl4j.jar
/var/local/apps/06/j2ee-apps/applications/web/jaxrpc.jar
/var/local/apps/06/j2ee-apps/applications/web/saaj.jar
/var/local/apps/06/j2ee-apps/applications/web/commons-beanutils-1.6.1.jar
/var/local/apps/06/j2ee-apps/applications/web/commons-discovery.jar
/var/local/apps/06/j2ee-apps/applications/web/commons-collections-3.0.jar
/var/local/apps/06/j2ee-apps/applications/web/cglib-full-2.0.2.jar
/var/local/apps/06/j2ee-apps/applications/web/commons-lang-1.0.1.jar
/var/local/apps/06/j2ee-apps/applications/web/dom4j-1.4.jar
/var/local/apps/06/j2ee-apps/applications/web/ehcache-0.9.jar
/var/local/apps/06/j2ee-apps/applications/web/hibernate2.jar
/var/local/apps/06/j2ee-apps/applications/web/hibernate-tools.jar
/var/local/apps/06/j2ee-apps/applications/web/jdom.jar
/var/local/apps/06/j2ee-apps/applications/web/jta.jar
/var/local/apps/06/j2ee-apps/applications/web/odmg-3.0.jar
/var/local/apps/06/j2ee-apps/applications/web/sso_client.jar
/var/local/apps/06/j2ee-apps/applications/web/intuit-shared.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/log4j-1.2.8.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-logging-api-1.0.3.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/cos-31oct2000.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/activeio-core-3.0-beta3.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-discovery.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/velocity-dep-1.4.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-beanutils-1.6.1.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/activemq-core-4.0.1.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-logging-1.0.4.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/commons-collections-3.0.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/jakarta-regexp-1.2.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/sso_client.jar
/var/local/apps/06/j2ee-apps/applications/web/webapp/WEB-INF/lib/velocity-1.4.jar

What am I missing?

Steve
-- 
View this message in context: http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5202922
Sent from the ActiveMQ - User forum at Nabble.com.


Re: NoClassDefFoundError ActiveMQConnectionFactory

Posted by James Strachan <ja...@gmail.com>.
Which version are you using and can you post a full stack trace please?

On 7/6/06, sgoyette <st...@goyettefamily.com> wrote:
>
> Hi,
>
> I'm trying to setup a connection to the broker using this code:
>
>      connectionFactory = new ActiveMQConnectionFactory(
> "tcp://localhost:61616" );
>      connection = connectionFactory.createTopicConnection();
>      connection.start();
>
> What's happening is that I'm getting the NoClassDefFound exception being
> thrown on the first line.  The libraries (all of the libraries) in the lib
> directory are in my classpath so I'm a bit confused as to why this would
> happen.
>
> Has anyone run in to this?  Any ideas?  There really isn't a lot more to
> say...this is really simple but for some reason it's just not working.
>
> Any help would be greatly appreciated.
>
> Steve
> --
> View this message in context: http://www.nabble.com/NoClassDefFoundError-ActiveMQConnectionFactory-tf1897757.html#a5191481
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/