Network Deployment (Distributed operating systems), v8.0 > Administer applications and their environment > Administer Messaging resources > Manage messaging with the default messaging provider > Use JMS from stand-alone clients to interoperate with service integration resources > Use JMS to connect to a WAS default messaging provider messaging engine
Use JMS resources with the Thin Client for JMS with WAS
Suitable JMS connection factories and references to JMS queues or topics might be obtained programmatically without using JNDI. Alternatively, full JNDI support might be obtained from the Thin Client for EJB with WAS.
Procedure
- To obtain suitable connection factories programmatically, without using JNDI, use code similar to that shown in the following example:
import com.ibm.websphere.sib.api.jms.*; ... JmsConnectionFactory jmsCF = JmsFactoryFactory.getInstance().createQueueConnectionFactory(); jmsCF.setBusName("myBus"); jmsCF.setProviderEndpoints("1.2.3.4");To obtain a suitable reference to a JMS queue or topic programmatically, use code similar to that shown in the following example:
JmsQueue jmsQ = JmsFactoryFactory.getInstance().createQueue("myQueue");For further information, see the JmsFactoryFactory class API documentation available with WAS.
- To obtain full JNDI support from the Thin Client for EJB with WAS:
- Include the /runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar file in the compile and runtime classpaths for your enterprise application as described in Configure the Thin Client for JMS with WAS.
- Use the following code to create a suitable Initial Context, substituting the server IP address and port as appropriate:
import javax.naming.*; ... Properties env = new Properties(); env.put(Context.PROVIDER_URL,"iiop: // <server IP address>: <server bootstrap address port>"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); InitialContext ctx = new InitialContext(env);In certain situations, for example when running with a Sun JRE, an additional ORB jar is also required. For additional information about when this jar is required, see Run the IBM Thin Client for EJB.
Run the IBM Thin Client for EJB