Topic
  • 5 replies
  • Latest Post - ‏2013-03-04T09:54:18Z by SystemAdmin
SystemAdmin
SystemAdmin
590 Posts

Pinned topic InitialContext for external JMS client and Liberty Profile 8.5.1 beta

‏2013-03-03T21:03:43Z |
I am trying to connect from separate JVM to JMS defined on WLP server. As the client works outside container the javax.naming.InitialContext has to provide extra properties to get to appserv. I have already found that "The Liberty profile does not support JNDI lookups using WsnInitialContextFactory". On the other hand documentation shows how to wire up two WLP servers to talk to each other via JMS using "hostname:7276:BootstrapBasicMessaging" configuration parameter. Is there a magic spell for external client to lookup right factory? If so what is the right classname/url and how to enable this in server.xml?

regards,
-andy.
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: InitialContext for external JMS client and Liberty Profile 8.5.1 beta

    ‏2013-03-03T22:19:01Z  
    I did homework and found the way without JNDI using SIB:

    1) I have enabled "jmsComms-1.0" feature in server.xml
    2) added to server.xml this configuration: <jmsCommsEndpoint id="InboundJmsCommsEndpoint" host="*" jmsPort="7276" jmsSSLPort="7286" />
    3) added "com.ibm.ws.sib.client.thin.jms_8.5.0.jar" from full WAS to class path
    4) and bootstrapped JMS via SIBus following documentation as on this snippet:

    import com.ibm.websphere.sib.api.jms.*;
    ...
    JmsFactoryFactory jff = JmsFactoryFactory.getInstance();
    JmsConnectionFactory jcf = jff.createConnectionFactory();
    jcf.setBusName("myBus");
    jcf.setProviderEndpoints("localhost:7276:BootstrapBasicMessaging");
    jcf.setTargetTransportChain("InboundBasicMessaging");
    Connection con = jcf.createConnection();
    Queue queue = jff.createQueue("myQueue");

    The rest uses JMS API. I made a connection (struggling with queue configuration now).
    The question rephrased is: can we bootstrap JMS via JNDI lookup from external application (to not use SIB directly) and bootstrap with pure JMS interfaces as on full WAS?

    regards,
    -andy.
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: InitialContext for external JMS client and Liberty Profile 8.5.1 beta

    ‏2013-03-03T23:15:53Z  
    Bad example in docs and stopped me for another hour... in "liberty_v85next_beta.pdf" page 59, there is example of messaging configuration. In server.xml the "queue" element is not wrapped by "messagingEngine" as it should be:

    <messagingEngine>
    <queue id="QUEUE1"
    ...
    </queue>
    </messagingEngine>

    regards,
    -andy.
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: InitialContext for external JMS client and Liberty Profile 8.5.1 beta

    ‏2013-03-04T05:27:21Z  
    I did homework and found the way without JNDI using SIB:

    1) I have enabled "jmsComms-1.0" feature in server.xml
    2) added to server.xml this configuration: <jmsCommsEndpoint id="InboundJmsCommsEndpoint" host="*" jmsPort="7276" jmsSSLPort="7286" />
    3) added "com.ibm.ws.sib.client.thin.jms_8.5.0.jar" from full WAS to class path
    4) and bootstrapped JMS via SIBus following documentation as on this snippet:

    import com.ibm.websphere.sib.api.jms.*;
    ...
    JmsFactoryFactory jff = JmsFactoryFactory.getInstance();
    JmsConnectionFactory jcf = jff.createConnectionFactory();
    jcf.setBusName("myBus");
    jcf.setProviderEndpoints("localhost:7276:BootstrapBasicMessaging");
    jcf.setTargetTransportChain("InboundBasicMessaging");
    Connection con = jcf.createConnection();
    Queue queue = jff.createQueue("myQueue");

    The rest uses JMS API. I made a connection (struggling with queue configuration now).
    The question rephrased is: can we bootstrap JMS via JNDI lookup from external application (to not use SIB directly) and bootstrap with pure JMS interfaces as on full WAS?

    regards,
    -andy.
    Hello Andy,
    Thanks for downloading and trying Liberty messaging, I will help in answering your queries related to messaging. Your observation is correct, Liberty profile does not support JNDI lookups using WsnInitialContextFactory because of which Thin clients (J2SE) cannot do a remote JNDI namespace lookup to access the JMS resources (eg ConnectionFactory, Activation Spec) defined within Liberty profile. As you have rightly identified, you have two options to allow your clients to access the JMS resources
    1) Use the com.ibm.ws.sib.client.thin.jms_8.5.0.jar from full profile WAS and create the connection factory objects
    JmsFactoryFactory jff = JmsFactoryFactory.getInstance();
    JmsConnectionFactory jcf = jff.createConnectionFactory();

    2) Define the JMS resources in full profile WAS and make your JMS application to do a lookup using WsnInitialContextFactory. In the ConnectionFactory, set the providerEndPoint attribute to point to the host and port of the Liberty messaging.

    Hence, at this point J2SE applications cannot do a direct lookup of JNDI namespace defined in Liberty profile. You will have to use any of the 2 options mentioned above.

    To answer your earlier post "On the other hand documentation shows how to wire up two WLP servers to talk to each other via JMS using "hostname:7276:BootstrapBasicMessaging" configuration parameter",

    What we support today is that, if an application is deployed in a Liberty profile (LP1), it can connect to a messaging engine running in a different Liberty profile (LP2). To achieve this, you will have to define the JMS resources on LP1, such that the JMS application on LP1 can do a local lookup of the JMS resources but the provider end point on the connection factory must point to the messaging engine running on LP2.

    Hope this clarifies your doubt, please do let me know if you have any further queries and I will be glad to assist you.

    Thanks
    Lohit
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: InitialContext for external JMS client and Liberty Profile 8.5.1 beta

    ‏2013-03-04T05:34:47Z  
    Bad example in docs and stopped me for another hour... in "liberty_v85next_beta.pdf" page 59, there is example of messaging configuration. In server.xml the "queue" element is not wrapped by "messagingEngine" as it should be:

    <messagingEngine>
    <queue id="QUEUE1"
    ...
    </queue>
    </messagingEngine>

    regards,
    -andy.
    Hello Andy,

    Sorry to hear that you had to spend lot of time to identify on how to define the queues and thanks for posting the issue. I will get this corrected.
    I just observed that "Deploying a messaging application to the Liberty profile" section on page 535 was updated to show the correct definition of the queue but not this section, I will get this rectified. Thanks

    Cheers,
    Lohit
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: InitialContext for external JMS client and Liberty Profile 8.5.1 beta

    ‏2013-03-04T09:54:18Z  
    Lohit, thank you for clarification, that closes the subject.
    regards,
    -andy.