Tomcat JNDI Server Configuration
Hello, How does one configure tomcat so that a hosted application could connect to a JMS Message server such as WebSphereMQ? I have managed to write a small test application in JMS and deployed it to tomcat and configured it to connect to MQ. This application defines the default initial context using InitialContext context = new InitialContext() And have configured the context.xml and web.xml. I have deployed and tested and it works quite well. However, I do not want to use the default context. I want to use code something like below: Hashtable env = new Hashtable() env.put(Context, contextValue) env.put(ProviderURL, theURL) etc InitialContext context = new InitialContext(env) My question is - What does this ProviderURL represents? Is it the URL to the JNDI service or is it the URL to the JMS message server? If it is the URL to the JNDI server, does tomcat have a separate JNDI server? If so, what is its URL? Thanks
Re: Tomcat JNDI Server Configuration
On Dec 12, 2013, at 4:25 AM, Vic Katte vicnka...@gmail.com wrote: Hello, What version of Tomcat are you using? How does one configure tomcat so that a hosted application could connect to a JMS Message server such as WebSphereMQ? I have managed to write a small test application in JMS and deployed it to tomcat and configured it to connect to MQ. This application defines the default initial context using InitialContext context = new InitialContext() Could you give us a larger code sample? This doesn't really show much. And have configured the context.xml and web.xml. What have you configured in these files? Include that too, minus comments. I have deployed and tested and it works quite well. However, I do not want to use the default context. Why do you not want to use the defaults? I want to use code something like below: Hashtable env = new Hashtable() env.put(Context, contextValue) env.put(ProviderURL, theURL) etc InitialContext context = new InitialContext(env) Again, why? What are you trying to achieve here? Why doesn't the default work? More context and information will help someone on this list to give you a better answer. My question is - What does this ProviderURL represents? Is it the URL to the JNDI service or is it the URL to the JMS message server? Not ringing any bells. Probably something specific to your JMS implementation. If it is the URL to the JNDI server, does tomcat have a separate JNDI server? If so, what is its URL? Tomcat has a JNDI implementation that you can use to access resources defined on the server. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html If you were to make your MQ resources available through JNDI (using the Resource/ tag), you could access them in your application through JNDI. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Using_resources Dan Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JNDI Server Configuration
Hello Dan, Thanks for responding. Without going too much into the code, I am trying to understand whether Tomcat does support the concept of a Naming Server. With JMS, it is possible to create and store administration objects such as ConnectionFactory, Destinations in a Naming Service (such as LDAP). Is it possible to use and external independent Naming Service, such as LDAP to store JMS Admin objects in conjunction with Tomcat? The whole idea of having a Naming Service was to separate objects. Thus your Naming Service hold the details of the objects one really wants to use. From the code, we connect to the Naming Service and obtain reference to the ConnectionFactory, say. We then use this reference to connect to the underlying JMS server encapsulated in the ConnFactory. Supposing my Naming Service URL/port is A.B.C.D/ and my JMS Server URL is E.F.G.H/ - What should one use as the Provider URL in this context? Does Tomcat have a Naming Service running inside it which stores the admin objects? If so, is it accessible via a URL? Thanks ViK On Thu, Dec 12, 2013 at 1:03 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Dec 12, 2013, at 4:25 AM, Vic Katte vicnka...@gmail.com wrote: Hello, What version of Tomcat are you using? How does one configure tomcat so that a hosted application could connect to a JMS Message server such as WebSphereMQ? I have managed to write a small test application in JMS and deployed it to tomcat and configured it to connect to MQ. This application defines the default initial context using InitialContext context = new InitialContext() Could you give us a larger code sample? This doesn't really show much. And have configured the context.xml and web.xml. What have you configured in these files? Include that too, minus comments. I have deployed and tested and it works quite well. However, I do not want to use the default context. Why do you not want to use the defaults? I want to use code something like below: Hashtable env = new Hashtable() env.put(Context, contextValue) env.put(ProviderURL, theURL) etc InitialContext context = new InitialContext(env) Again, why? What are you trying to achieve here? Why doesn't the default work? More context and information will help someone on this list to give you a better answer. My question is - What does this ProviderURL represents? Is it the URL to the JNDI service or is it the URL to the JMS message server? Not ringing any bells. Probably something specific to your JMS implementation. If it is the URL to the JNDI server, does tomcat have a separate JNDI server? If so, what is its URL? Tomcat has a JNDI implementation that you can use to access resources defined on the server. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html If you were to make your MQ resources available through JNDI (using the Resource/ tag), you could access them in your application through JNDI. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Using_resources Dan Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JNDI Server Configuration
On Dec 12, 2013, at 1:42 PM, Vic Katte vicnka...@gmail.com wrote: Hello Dan, First, please don't top post. Reply inline, like me, or at the bottom. That is the convention followed on this list. Thanks for responding. Without going too much into the code, I am trying to understand whether Tomcat does support the concept of a Naming Server. Yes. See the link I sent in the previous email. With JMS, it is possible to create and store administration objects such as ConnectionFactory, Destinations in a Naming Service (such as LDAP). You can define these in Tomcat by using Resource / tags. Again, see the link I sent previously. Is it possible to use and external independent Naming Service, such as LDAP to store JMS Admin objects in conjunction with Tomcat? You can connect to an LDAP server, but that has nothing to do with Tomcat. You'd just use the functionality present in the JVM. The whole idea of having a Naming Service was to separate objects. Thus your Naming Service hold the details of the objects one really wants to use. From the code, we connect to the Naming Service and obtain reference to the ConnectionFactory, say. We then use this reference to connect to the underlying JMS server encapsulated in the ConnFactory. Supposing my Naming Service URL/port is A.B.C.D/ and my JMS Server URL is E.F.G.H/ - What should one use as the Provider URL in this context? There is no url, server or port required when loading items from JNDI with Tomcat. See the links I previously sent which show how to grab objects from JNDI. Does Tomcat have a Naming Service running inside it which stores the admin objects? Yes, it has naming service, but I'm not sure what you mean by admin objects. Anything you configure with Resource tags will be available to your applications through JNDI. If you don't configure it, it won't be available. If so, is it accessible via a URL? Yes. Resources are located in JNDI with the URL java:comp/env/ The rest of the path depends on what you setup in your Resource tag. Dan Thanks ViK On Thu, Dec 12, 2013 at 1:03 PM, Daniel Mikusa dmik...@gopivotal.comwrote: On Dec 12, 2013, at 4:25 AM, Vic Katte vicnka...@gmail.com wrote: Hello, What version of Tomcat are you using? How does one configure tomcat so that a hosted application could connect to a JMS Message server such as WebSphereMQ? I have managed to write a small test application in JMS and deployed it to tomcat and configured it to connect to MQ. This application defines the default initial context using InitialContext context = new InitialContext() Could you give us a larger code sample? This doesn't really show much. And have configured the context.xml and web.xml. What have you configured in these files? Include that too, minus comments. I have deployed and tested and it works quite well. However, I do not want to use the default context. Why do you not want to use the defaults? I want to use code something like below: Hashtable env = new Hashtable() env.put(Context, contextValue) env.put(ProviderURL, theURL) etc InitialContext context = new InitialContext(env) Again, why? What are you trying to achieve here? Why doesn't the default work? More context and information will help someone on this list to give you a better answer. My question is - What does this ProviderURL represents? Is it the URL to the JNDI service or is it the URL to the JMS message server? Not ringing any bells. Probably something specific to your JMS implementation. If it is the URL to the JNDI server, does tomcat have a separate JNDI server? If so, what is its URL? Tomcat has a JNDI implementation that you can use to access resources defined on the server. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html If you were to make your MQ resources available through JNDI (using the Resource/ tag), you could access them in your application through JNDI. http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Using_resources Dan Thanks - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org