<div dir="ltr">Off hand, it appears that you're missing some libraries.  I'm not sure what rabbitmqjms.jar is as I've not looked at the JMS stuff personally but you're missing whatever library provides "com.rabbitmq.jms.admin.<span style="font-family:arial,sans-serif;font-size:13px">RMQConnectionFactory</span>".  What's interesting is that it's in the same class structure as the instance loader (the RMQObjectFactory) - so I'd guess there could be an issue someplace with URL class loading or similar.  If the ObjectFactory and ConnectionFactory are with-in the same jar you shouldn't be getting this, but if they're in a different jar file you'll very likely have issues.  Java doesn't support loading JAR files from with-in a JAR file for dependencies.<div>
<br></div><div>Jason</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, May 17, 2014 at 6:40 PM, scguy <span dir="ltr"><<a href="mailto:npetrace@gmail.com" target="_blank">npetrace@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Question...I'm trying to use the RabbitMQ JMS client with an existing JMS<br>
client application.<br>
<br>
I have written a sample java program, and am referencing a .bindings file<br>
(below).  I have the following plugins installed on my RabbitMQ server (this<br>
is on Windows):<br>
<br>
C:\dev\rabbitmq330\rabbit\sbin>rabbitmq-plugins list<br>
[e] amqp_client                       3.3.0<br>
[ ] cowboy                            0.5.0-rmq3.3.0-git4b93c2d<br>
[ ] eldap                             3.3.0-gite309de4<br>
[e] mochiweb                          2.7.0-rmq3.3.0-git680dba8<br>
[ ] rabbitmq_amqp1_0                  3.3.0<br>
[ ] rabbitmq_auth_backend_ldap        3.3.0<br>
[ ] rabbitmq_auth_mechanism_ssl       3.3.0<br>
[ ] rabbitmq_consistent_hash_exchange 3.3.0<br>
[ ] rabbitmq_federation               3.3.0<br>
[ ] rabbitmq_federation_management    3.3.0<br>
[E] rabbitmq_jms_topic_exchange       1.2.0-rmq3.3.0<br>
[e] rabbitmq_jsonrpc                  3.3.x-24fb08eb<br>
[E] rabbitmq_jsonrpc_channel          3.3.x-40bdb08c<br>
[E] rabbitmq_management               3.3.0<br>
[e] rabbitmq_management_agent         3.3.0<br>
[E] rabbitmq_management_visualiser    3.3.0<br>
[ ] rabbitmq_mqtt                     3.3.0<br>
[ ] rabbitmq_shovel                   3.3.0<br>
[ ] rabbitmq_shovel_management        3.3.0<br>
[E] rabbitmq_stomp                    3.3.0<br>
[ ] rabbitmq_tracing                  3.3.0<br>
[e] rabbitmq_web_dispatch             3.3.0<br>
[ ] rabbitmq_web_stomp                3.3.0<br>
[ ] rabbitmq_web_stomp_examples       3.3.0<br>
[e] rfc4627_jsonrpc                   3.3.x-git5e67120<br>
[ ] sockjs                            0.3.4-rmq3.3.0-git3132eb9<br>
[e] webmachine                        1.10.3-rmq3.3.0-gite9359c7<br>
<br>
I have the following on my classpath:<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<classpath><br>
    <classpathentry kind="src" path="src"/><br>
    <classpathentry kind="con"<br>
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_25"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/dependencies/amqp-client-3.3.0.jar"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/dependencies/fscontext.jar"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/dependencies/geronimo-jms_1.1_spec-1.1.1.jar"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/dependencies/providerutil.jar"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/dependencies/slf4j-api-1.7.5.jar"/><br>
    <classpathentry kind="lib"<br>
path="C:/dev/rabbitmq330/jms-package1.2.0/rabbitmq-jms-1.2.0.jar"/><br>
    <classpathentry kind="output" path="bin"/><br>
</classpath><br>
<br>
However, when I attempt to run my java program, I get the following error.<br>
This is where I am stuck...I'm not sure what is wrong...as the mentioned<br>
class is in the rabbitmq-jms-1.2.0.jar file, and that jar is on my<br>
classpath.  Any thoughts on what I have done wrong?  I need to use the JMS<br>
client...otherwise I would just use the AMQP library.<br>
<br>
Code snippet (the error occurs on the connection factory lookup):<br>
<br>
Hashtable<String, String> env = new Hashtable<String, String>();<br>
env.put(Context.INITIAL_CONTEXT_FACTORY,<br>
"com.sun.jndi.fscontext.RefFSContextFactory");<br>
env.put(Context.PROVIDER_URL, "file:/rabbitmq"); // directory where the<br>
.bindings file is located<br>
<br>
mContext = new InitialContext(env);<br>
<br>
ConnectionFactory connectionFactory = (ConnectionFactory)<br>
mContext.lookup("ConnectionFactory");<br>
mConnection = connectionFactory.createConnection();<br>
mConnection.start();<br>
<br>
.bindings file:<br>
<br>
ConnectionFactory/ClassName=com.rabbitmq.jms.admin.RMQConnectionFactory<br>
ConnectionFactory/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory<br>
<br>
ConnectionFactory/RefAddr/0/Content=jms/ConnectionFactory<br>
ConnectionFactory/RefAddr/0/Type=name<br>
ConnectionFactory/RefAddr/0/Encoding=String<br>
<br>
ConnectionFactory/RefAddr/1/Content=javax.jms.ConnectionFactory<br>
ConnectionFactory/RefAddr/1/Type=type<br>
ConnectionFactory/RefAddr/1/Encoding=String<br>
<br>
ConnectionFactory/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory<br>
ConnectionFactory/RefAddr/2/Type=factory<br>
ConnectionFactory/RefAddr/2/Encoding=String<br>
<br>
# Change this line accordingly if the broker is not at localhost<br>
ConnectionFactory/RefAddr/3/Content=localhost<br>
ConnectionFactory/RefAddr/3/Type=host<br>
ConnectionFactory/RefAddr/3/Encoding=String<br>
<br>
#Destinations<br>
TempQueue/ClassName=com.rabbitmq.jms.admin.RMQDestination<br>
TempQueue/FactoryName=com.rabbitmq.jms.admin.RMQObjectFactory<br>
<br>
TempQueue/RefAddr/0/Content=jms/Queue<br>
TempQueue/RefAddr/0/Type=name<br>
TempQueue/RefAddr/0/Encoding=String<br>
<br>
TempQueue/RefAddr/1/Content=javax.jms.Queue<br>
TempQueue/RefAddr/1/Type=type<br>
TempQueue/RefAddr/1/Encoding=String<br>
<br>
TempQueue/RefAddr/2/Content=com.rabbitmq.jms.admin.RMQObjectFactory<br>
TempQueue/RefAddr/2/Type=factory<br>
TempQueue/RefAddr/2/Encoding=String<br>
<br>
TempQueue/RefAddr/3/Content=TempQueue<br>
TempQueue/RefAddr/3/Type=destinationName<br>
TempQueue/RefAddr/3/Encoding=String<br>
<br>
C:\TEMP>java -jar rabbitmqjms.jar<br>
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".<br>
SLF4J: Defaulting to no-operation (NOP) logger implementation<br>
SLF4J: See <a href="http://www.slf4j.org/codes.html#StaticLoggerBinder" target="_blank">http://www.slf4j.org/codes.html#StaticLoggerBinder</a> for further<br>
details.<br>
Exception in thread "main" java.lang.reflect.InvocationTargetException<br>
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
        at<br>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br>
        at<br>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>
        at java.lang.reflect.Method.invoke(Method.java:606)<br>
        at<br>
org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)<br>
Caused by: javax.naming.NamingException: Unknown class<br>
[com.rabbitmq.jms.admin.RMQConnectionFactory]<br>
        at<br>
com.rabbitmq.jms.admin.RMQObjectFactory.getObjectInstance(RMQObjectFactory.java:132)<br>
        at<br>
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)<br>
        at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)<br>
        at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)<br>
        at javax.naming.InitialContext.lookup(InitialContext.java:411)<br>
        at rabbitMQJMSTestDriver.<init>(rabbitMQJMSTestDriver.java:31)<br>
        at rabbitMQJMSTestDriver.main(rabbitMQJMSTestDriver.java:107)<br>
        ... 5 more<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/JNDI-bindings-with-RabbitMQ-JMS-Client-tp35631.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/JNDI-bindings-with-RabbitMQ-JMS-Client-tp35631.html</a><br>

Sent from the RabbitMQ mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Jason McIntosh<br><a href="https://github.com/jasonmcintosh/" target="_blank">https://github.com/jasonmcintosh/</a><br>573-424-7612</div>
</div>