javax.naming.NoInitialContextException: Unable to find the InitialContextFactory com.tibco.tibjms.naming.TibjmsInitialContextFactory - jms

I have developed TIBCO EMS standalone client developed which is used in Adobe Livecycle to send requests to tibco queue. Getting the below error.
Going by the error, not able to load InitialContextFactory.
Error snapshot below.
javax.naming.NoInitialContextException: Unable to find the InitialContextFactory com.tibco.tibjms.naming.TibjmsInitialContextFactory.
org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:149)
org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:50)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:696)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:319)
javax.naming.InitialContext.init(InitialContext.java:254)
javax.naming.InitialContext.<init>(InitialContext.java:228)
com.citigroup.gsu.edelivery.engine.utils.TibcoEMS.ServiceLocator.getInstance(ServiceLocator.java:34)
com.citigroup.gsu.edelivery.engine.utils.TibcoEMS.TibcoEMSClient.SendTibcoEMSMessage(TibcoEMSClient.java:36)
Code snippet details below.
TibcoEMSClient.java:36
serviceLocator = ServiceLocator.getInstance(user,password, providerUrl);
ServiceLocator.java:34
env.put(Context.INITIAL_CONTEXT_FACTORY, providerContextFactory);
env.put(Context.PROVIDER_URL, providerUrl);
ic = new InitialContext(env);
Please help.

Looks like classpath issue. You need to add tibjms.jar to your project classpath or to the applications server classpath. The Jar file you can get from tibco installation folder for example C:\tibco\ems\6.0\lib or download from tibco web site. If you are using ssl you may also need tibcrypt.jar
How to add tibjms.jar to classpath depends on your application server.
For WebSphere this document may help https://docs.tibco.com/pub/enterprise_message_service/6.0.1_january_2011/html/tib_ems_integration_guide/wwhelp/wwhimpl/common/html/wwhelp.htm#href=appint.5.17.htm&single=true
Please see steps:
Add TIBCO Enterprise Message Service as a JMS Provider This section
configures WebSphere to uses TIBCO Enterprise Message Service as a JMS
provider.
Start the WebSphere application server.
Start the WebSphere Administrative Console.
In the WebSphere navigation pane, choose Resources > JMS > JMS providers.
In the content pane, click the New button.
Enter the following values for the required properties: Name TIBCO Description TIBCO Enterprise Message Service Classpath
EMS_HOME\lib\tibjms.jar External Initial Context Factory
com.tibco.tibjms.naming.TibjmsInitialContextFactory External Provider
URL tibjmsnaming://localhost:7222
Click the OK button.
Click the Apply button.

Related

How to use ECF JMS/ActiveMQ provider with remote services?

In order to make an OSGI service to be remotely accessible, I'd like to use ActiveMQ JMS broker as a distribution provider inside ECF framework. Which steps should I take?
I'll be answering my own question in order to document it.
Get a minimal working ECF remote service workspace, with ecf.generic.server as the distribution and one of the discovery providers (zookeeper for example). You can use http://wiki.eclipse.org/EIG:Getting_Started_with_OSGi_Remote_Services tutorial.
Install an ActiveMQ broker with default configuration.
Download the JMS/ActiveMQ ECF providers from https://github.com/ECF/JMS. Add the org.eclipse.ecf.provider.jms and org.eclipse.ecf.provider.jms.activemq projects in your workspace, build and add them to your run configuration or target platform.
For the provider service properties, do the following changes:
a. Change the "service.exported.configs" property for as "ecf.jms.activemq.tcp.client"
b. Add "ecf.endpoint.connecttarget.id" property with the following value "tcp://[ACTIVEMQ_IP]:61616/rs_topic", replacing [ACTIVEMQ_IP] with the broker IP. You can also change the topic name as something related to your service.
Now we also need a ActiveMQ JMS Server Container. Add the following code to the provider side. Use the Activator or fire up a new component with DS. You can also get an IContainerFactory object from the service registry.
IContainerFactory containerFactory = ContainerFactory.getDefault();
containerFactory.createContainer("ecf.jms.activemq.tcp.manager",
new Object[] { "tcp://[ACTIVEMQ_IP]:61616/rs_topic" });

An attempt was made to retrieve an initial context for [ClassName] but no JNDI feature is configured

I am using the IBM WebSphere Application server v8.5 Liberty Profile. I have enabled the feature jndi-1.0 in server.xml by adding
<feature>jndi-1.0</feature>
But still I get the error "An attempt was made to retrieve an initial context for [ClassName] but no JNDI feature is configured."
Any idea what I may be doing wrong?

Deploy MDB on WebLogic 10.3

I am new to MDB, so my questions may sound simple.
I implemented an MDB( serving as a Consumer ) using JDeveloper 11.1.7 and built a JAR file using deployment functionality. Now I need to deploy it to WebLogic 10.3 app server. I have several questions:
1) Should I deploy it as a library or as an application?
2) After I successfully deploy and it's in the "RUNNING" mode I assume it should be listening to the particular Queue I specified as a Resource in my MDB implementation. Is that correct?
3) When implementing an MDB all the examples only specify the "destination" but not the "ConnectionFactory". How does it know where to connect to?
Should I deploy it as a library or as an application?
Deploy as an application since the MDB will likely contain business logic specific to the app.
After I successfully deploy and it's in the "RUNNING" mode I assume it
should be listening to the particular Queue I specified as a Resource
in my MDB implementation. Is that correct?
Yes, if your JMS provider is local, specify the name bound in the local JNDI tree for the destination using destination-jndi-name.
When implementing an MDB all the examples only specify the
"destination" but not the "ConnectionFactory". How does it know where
to connect to?
If the MDB is consuming messages from the local WebLogic JMS provider, the container manages configuration for the connections and sessions automatically, so don't set provider-url, initial-context-factory, or connection-factory-jndi-name, unless you have a custom factory to use.
Refer to WebLogic 10.3 documentation for details:

Setting up MDBs to consume JMS messages in Weblogic 10.3.5

I'm trying to set up part of an application which uses MDBs to consume messages from a JMS Queue. I've looked through the Oracle documentation but can't seem to make sense of it. Examples on the internet seem to be for situations where your JMS server is the same weblogic server where you are consuming but in my case there is a separate server.
I've found this post Weblogic EJB connection to external Tibco EMS JMS Queue which gives broad strokes but seems to be written more for experienced weblogic users.
Specifically with the linked here is where I'm having trouble:
Create a foreign server with all the normal details (local/remote JNDI lookup names for destination and connection factories).
Not sure how to do this.
Create a local WL user with the same name as the remote EMS user, including password.
I cannot do this as my password is less than 8 characters
Create an ejb credential mapping (NOT security credential mapping)
do this by clicking on the relevant deployment, click on the relevant ejb name in the list, then Security tab then Credentials Mapping tab.
add the same name for WLS and Remote users (password doesn't seem to be necessary here).
Under Security I see Application/Module Scope tabs and Roles/Policies underneath those.
Can anyone give more detailed steps on how to set up a simple MDB in Weblogic 10.3.5 which consumes JMS messages from an external server (Tibco EMS)?
I have an ldap url, a selector (to filter out unwanted messages, not completely necessary), username and password, Queue name, EMS server url (which specifies a port), connection factory ldap. What do I do with this information?
You can configure a foreign server in weblogic and inside the foreign server you can provide the connection factory & destination details. The username, passwd & queue name that you have will be required to create these weblogic admin objects.
Weblogic foreign server configuration
While creating the destination you can provide the local jndi name which you can use in your MDB Activation configuration to connect to.

configure jndi.xml in serviceMix to work with MQseries

My j2EE app is currently running on ServiceMix. Now i want to add JMS to my app. The application should able to send/receive the JMS message to/from the queue that stays on MQSeries.
mq.hostname=10.3.6.19
mq.channel=CHANNEL
mq.queueManager=QManager
mq.port=1422
What i would like to do is:
1. Create a jndi.xml file and do configuration for jms stuff.
2. my app will initialize the context, look up jndi name, and create a connection, queueManager, queue. .etc
3. Develop send and receive methods.
My question is:
Can you tell me how to do 1st and 2nd steps.
(the script inside ServiceMix's jndi is diffrent with tomcat's
jndi and others.
ServiceMix using Spring based JNDI provider.
http://servicemix.apache.org/jndi-configuration.html)
I just ran into something similar with Weblogic. The following link uses spring-dm to integrate with websphere. It also takes it to the next logical step and adds camel to the mix.
http://lowry-techie.blogspot.com/2010/11/camel-integration-with-websphere-mq.html
Without using Spring-dm, you may run into classloader issues when trying to load the InitialContextFactory from the websphere jar (this is an issue I had with the Weblogic jar)

Resources