• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS Queues & Connection Factories - Remote JNDI lookup  RSS feed

 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would anyone be able to direct me to a clear and concise resource (how-to, tutorial, article, tip, etc.) that explains how to do the following.

- Create a Connection Factory and a Queue on Machine A.

- Send and/or receive messages to and/or from the Queue from Machine B.

The specific part of this relatively simple JMS example I'm having a problem with is providing Machine B remote access to the Queue located on Machine A.

Do I have to configure the parameters of the Connection Factory a certain way?

Is it a matter of explicitly providing the correct arguments when creating the InitialContext for the JNDI lookup?

Both?
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What JMS Provider are you using? It is just a matter of obtaining a ConnectionFactory (typically thru JNDI) and then using it to either send a message or register a MessageListener.
 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allright...I'm gonna do my best to not seem too ignorant here....this is the first time I've worked with JMS, so please bear with me.

The JMS provider I'm using is the RI Server I downloaded from Sun, started by performing "j2ee -verbose" via the command line. But, as far as I know...I may not being doing this correctly.

I think the problem I'm having is setting up the Properties so I can provide them as arguments to the InititalContext constructor to ensure that Machine B knows where to find the objects on Machine A.

The following is what I'm currently trying...and is not working.

 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another question I just thought of while perusing Sun's site. How does one decide which Service Provider to use when setting the environement properties. Do these "Service Providers" relate in any way to the "JMS Provider" you mentioned?

http://java.sun.com/products/jndi/serviceproviders.html

Thanks again...
 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another thing....

Do I even need to modify the INITIAL_CONTEXT_FACTORY property or do I just need to provide Machine B the ability to remotely see Machine A's jndi.properties file?

I'm sure you can tell by these questions I'm inexperienced with this...but I hope they aren't stupid questions and indicate that at least I'm on the right track.
 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK....I resolved the problem by using the properties I found in the last post of the following thread.

http://www.coderanch.com/t/309426/EJB-JEE/java/JMS-JNDI


But....I still would like to know how one chooses which properties to use for any given situation.

Thanks
 
Bryan Noll
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Allright....you'd think I have severe ADD/HD with how many times I post, re-post, answer my own questions, etc....but when I tried this remotely, I received the following error.

Naming exception : Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialIn
Exception: com.sun.enterprise.naming.SerialInitContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:217)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at TestQueueRemote.send(TestQueueRemote.java:97)
at TestQueueRemote.main(TestQueueRemote.java:49)



Thanks for bothering to read through my insanity.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!