You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Sean Beck <se...@gmail.com> on 2013/06/27 01:45:05 UTC
ConnectionFactory issue
I am trying to compile my java code and need javax.jms.ConnectionFactory. I
am pretty sure I am including the right jar files in the classpath
(geronimo-jms_1.1_spec-1.1.1.jar) because it does create my .class files
properly. However when I run my program it gives me this:
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/jms/ConnectionFactory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
at java.lang.Class.getMethod0(Class.java:2694)
at java.lang.Class.getMethod(Class.java:1622)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: javax.jms.ConnectionFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 6 more
What could be causing this?
Thanks.
Re: ConnectionFactory issue
Posted by Sean Beck <se...@gmail.com>.
Awesome that did it. Thanks!
On Wed, Jun 26, 2013 at 6:06 PM, Christian Posta
<ch...@gmail.com>wrote:
> yah, something might be dependent on spring stuff...
> check out that link i pasted.. should show how to include whole directories
>
>
> On Wed, Jun 26, 2013 at 5:03 PM, Sean Beck <se...@gmail.com>
> wrote:
>
> > I see. Is there a way to specify a whole directory to be included in the
> > classpath? Your suggestion fixed that problem for ConnectionFactory but
> now
> > I have it with ApplicationContextAware which I didn't realize is even
> being
> > used in my program
> >
> > On Wed, Jun 26, 2013 at 6:01 PM, Christian Posta
> > <ch...@gmail.com>wrote:
> >
> > > yep, compiling will produce the byte code. but when you run it, the
> > runtime
> > > libs must be made available to the code that uses it.
> > >
> > >
> > > On Wed, Jun 26, 2013 at 4:58 PM, Sean Beck <se...@gmail.com>
> > > wrote:
> > >
> > > > I am compiling like so:
> > > >
> > > > javac -cp
> > > >
> > > >
> > >
> >
> /apache-activemq-5.8.0/lib/geronimo-jms_1.1_spec-1.1.1.jar:/apache-activemq-5.8.0/lib/camel/camel-jms-2.10.3.jar:/apache-activemq-5.8.0/activemq-all-5.8.0.jar:/apache-activemq-5.8.0/lib/camel/camel-core-2.10.3.jar:.
> > > > QueueListener.java
> > > >
> > > > So everything already should be in the classpath
> > > >
> > >
> > >
> > >
> > > --
> > > *Christian Posta*
> > > http://www.christianposta.com/blog
> > > twitter: @christianposta
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>
Re: ConnectionFactory issue
Posted by Christian Posta <ch...@gmail.com>.
yah, something might be dependent on spring stuff...
check out that link i pasted.. should show how to include whole directories
On Wed, Jun 26, 2013 at 5:03 PM, Sean Beck <se...@gmail.com> wrote:
> I see. Is there a way to specify a whole directory to be included in the
> classpath? Your suggestion fixed that problem for ConnectionFactory but now
> I have it with ApplicationContextAware which I didn't realize is even being
> used in my program
>
> On Wed, Jun 26, 2013 at 6:01 PM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > yep, compiling will produce the byte code. but when you run it, the
> runtime
> > libs must be made available to the code that uses it.
> >
> >
> > On Wed, Jun 26, 2013 at 4:58 PM, Sean Beck <se...@gmail.com>
> > wrote:
> >
> > > I am compiling like so:
> > >
> > > javac -cp
> > >
> > >
> >
> /apache-activemq-5.8.0/lib/geronimo-jms_1.1_spec-1.1.1.jar:/apache-activemq-5.8.0/lib/camel/camel-jms-2.10.3.jar:/apache-activemq-5.8.0/activemq-all-5.8.0.jar:/apache-activemq-5.8.0/lib/camel/camel-core-2.10.3.jar:.
> > > QueueListener.java
> > >
> > > So everything already should be in the classpath
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Re: ConnectionFactory issue
Posted by Sean Beck <se...@gmail.com>.
I see. Is there a way to specify a whole directory to be included in the
classpath? Your suggestion fixed that problem for ConnectionFactory but now
I have it with ApplicationContextAware which I didn't realize is even being
used in my program
On Wed, Jun 26, 2013 at 6:01 PM, Christian Posta
<ch...@gmail.com>wrote:
> yep, compiling will produce the byte code. but when you run it, the runtime
> libs must be made available to the code that uses it.
>
>
> On Wed, Jun 26, 2013 at 4:58 PM, Sean Beck <se...@gmail.com>
> wrote:
>
> > I am compiling like so:
> >
> > javac -cp
> >
> >
> /apache-activemq-5.8.0/lib/geronimo-jms_1.1_spec-1.1.1.jar:/apache-activemq-5.8.0/lib/camel/camel-jms-2.10.3.jar:/apache-activemq-5.8.0/activemq-all-5.8.0.jar:/apache-activemq-5.8.0/lib/camel/camel-core-2.10.3.jar:.
> > QueueListener.java
> >
> > So everything already should be in the classpath
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>
Re: ConnectionFactory issue
Posted by Christian Posta <ch...@gmail.com>.
yep, compiling will produce the byte code. but when you run it, the runtime
libs must be made available to the code that uses it.
On Wed, Jun 26, 2013 at 4:58 PM, Sean Beck <se...@gmail.com> wrote:
> I am compiling like so:
>
> javac -cp
>
> /apache-activemq-5.8.0/lib/geronimo-jms_1.1_spec-1.1.1.jar:/apache-activemq-5.8.0/lib/camel/camel-jms-2.10.3.jar:/apache-activemq-5.8.0/activemq-all-5.8.0.jar:/apache-activemq-5.8.0/lib/camel/camel-core-2.10.3.jar:.
> QueueListener.java
>
> So everything already should be in the classpath
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Re: ConnectionFactory issue
Posted by Sean Beck <se...@gmail.com>.
I am compiling like so:
javac -cp
/apache-activemq-5.8.0/lib/geronimo-jms_1.1_spec-1.1.1.jar:/apache-activemq-5.8.0/lib/camel/camel-jms-2.10.3.jar:/apache-activemq-5.8.0/activemq-all-5.8.0.jar:/apache-activemq-5.8.0/lib/camel/camel-core-2.10.3.jar:.
QueueListener.java
So everything already should be in the classpath
Re: ConnectionFactory issue
Posted by Christian Posta <ch...@gmail.com>.
you'll have to make sure the geronimo spec jar (and all other runtime
dependencies) are on the classpath when you run your main class.
http://en.wikipedia.org/wiki/Classpath_(Java)#Basic_usage
On Wed, Jun 26, 2013 at 4:45 PM, Sean Beck <se...@gmail.com> wrote:
> I am trying to compile my java code and need javax.jms.ConnectionFactory. I
> am pretty sure I am including the right jar files in the classpath
> (geronimo-jms_1.1_spec-1.1.1.jar) because it does create my .class files
> properly. However when I run my program it gives me this:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> javax/jms/ConnectionFactory
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
> at java.lang.Class.getMethod0(Class.java:2694)
> at java.lang.Class.getMethod(Class.java:1622)
> at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
> at
> sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
> Caused by: java.lang.ClassNotFoundException: javax.jms.ConnectionFactory
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> ... 6 more
>
> What could be causing this?
>
> Thanks.
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta