Exception in thread "Thread-0" java.lang.NoClassDefFoundError: com/rabbitmq/client/ConnectionFactory
at com.protonss.resortApp.Rabbit_Message_Queue.SendMessage(Rabbit_Message_Queue.java:41)
at com.protonss.resortApp.CardMonitorMainThread.handleCard(CardMonitorMainThread.java:357)
at com.protonss.resortApp.CardMonitorMainThread.run(CardMonitorMainThread.java:171)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.rabbitmq.client.ConnectionFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Using the below code:
public boolean SendMessage (String IP , byte[] ImageBinary )
{
boolean Result = false;
try
{
Utilities.log("ConnectionFactory factory = new ConnectionFactory(); ImageBinary :"+ImageBinary, "IP"+IP );
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(IP);
Utilities.log(" factory.setHost(IP);",IP);
Connection connection = factory.newConnection();
Utilities.log(" Connection connection = factory.newConnection();",IP);
Channel channel = connection.createChannel();
Utilities.log(" Channel channel = connection.createChannel();","");
channel.queueDeclare(QUEUE_NAME,
false, false, false, null);
Utilities.log(" channel.queueDeclare(QUEUE_NAME, false, false, false, null);" , QUEUE_NAME);
channel.basicPublish("", QUEUE_NAME, null, ImageBinary);
Utilities.log(" channel.basicPublish(, QUEUE_NAME, null, ImageBinary); " , QUEUE_NAME);
System.out.println(" [x] Sent '" + ImageBinary.toString() + "'");
Utilities.log(" ****************************************SendMessage sent **********************************************" , "");
channel.close();
Utilities.log(" SendMessage: channel Close " , "");
connection.close();
Utilities.log(" SendMessage:connection Close" , "");
Result=true;
Utilities.log(" SendMessage: result true " , "");
}
catch(Exception Ex )
{
Utilities.logError(Ex.getMessage());
}
return Result ;
}
The jar files are included in the compilation time and accordingly, the run-time.
I too included the command "export CP=.:amqp-client-4.0.2.jar:slf4j-api-1.7.21.jar:slf4j-simple-1.7.22.jar" in the startup script prior to calling the Java service but still the same issue.
Any swift support is highly appreciated.
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.