[rabbitmq-discuss] ConnectionFactory Class not found in Java

George gray at mix.wvu.edu
Sun Jul 15 12:32:09 BST 2012


I resolved the issue. It needed the -classpath option on the java run 
command also. 

On Saturday, July 14, 2012 8:03:46 PM UTC-7, George wrote:
>
> I am attempting to run a Java class I developed called Send to publish 
> messages. It breaks on creating a connection. This is on a Windows server 
> with the RabbitMQ service running successfully - I can use it fine with 
> Node. 
>
> Here is my Java compile statement:
> C:\java>javac -classpath 
> commons-io-1.2.jar;commons-cli-1.1.jar;junit.jar;rabbitmq-client.jar;rabbitmq-client-tests.jar 
> Send.java
>
> Here is the code
> import com.rabbitmq.client.ConnectionFactory;
> import com.rabbitmq.client.Connection;
> import com.rabbitmq.client.Channel;
> import com.rabbitmq.client.*;
>
> public class Send {
>
>   public static void main(String[] argv) throws Exception {
>
>       ConnectionFactory factory = new ConnectionFactory();
>
>   }
> }
>
> Here are the results
> C:\java>java Send
> Exception in thread "main" java.lang.NoClassDefFoundError: 
> com/rabbitmq/client/ConnectionFactory
>         at Send.main(Send.java:10)
> Caused by: java.lang.ClassNotFoundException: 
> com.rabbitmq.client.ConnectionFactory
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.net.URLClassLoader$1.run(Unknown Source)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>
> Has anyone encountered and resolved this issue? Two thoughts I have are 
> ConnectionFactory is dependent on classes not in my compile command and 
> that ConnectionFactory has no parameter-less definitions. 
>
> Thanks for any help,
>
> George
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120715/46bb273f/attachment.htm>


More information about the rabbitmq-discuss mailing list