Introducing the all-new TIBCO Community site!

For current users, please click "Sign In" to reset your password and access the enhanced features. If you're a first-time visitor, we extend a warm welcome—click "Sign Up" to become a part of the TIBCO Community!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

Jump to content

Create JNDI Configuration for EMS in Tomcat application Context.xml file.


Recommended Posts

We have an existing application that uses JMS with ActiveMQ deployed to a Tomcat v6 web server for messaging. We are moving away from ActiveMQ and beginning to use Tibco EMS instead. I have been unsuccessfull at getting the JNDI context configured correctly to get a successful connection. Below are examples of our existing connection with ActiveMQ, the latest configuration file I've tried using Tibco EMS, and a snippet of the code. The only message returned after trying to create the connection factory is "null".

 

Any ideas what the correct parameters are that need to be in an application context.xml file to create a JNDI connection to Tibco EMS deployed to Tomcat

 

Current ActiveMQ Context Configuration:

 

 

 

Proposed Tibco EMS Context Configuration:

 

 

 

Application Source Code:

import javax.jms.Connection;

import javax.jms.ConnectionFactory;

import javax.jms.Session;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.servlet.ServletContext;

 

private ConnectionFactory connectionFactory;

private Session session;

private Connection connection;

private boolean transacted;

private static int ackMode = 1;

private static Context envCtx = null;

public static ServletContext context = null;

 

public void getConnection() {

try {

System.out.println("ConManager opening JMS connection and session");

connectionFactory = (ConnectionFactory)envCtx.lookup("jms/ConnectionFactory");

connection = connectionFactory.createConnection();

connection.setExceptionListener(this);

connection.start();

session = connection.createSession(transacted, ackMode);

} catch(Exception exception) {

System.out.println((new StringBuilder()).append("Error creating Connection ").append(exception.getMessage()).toString());

}

}

Link to comment
Share on other sites

  • 1 year later...

I've been trying to do exactly this and get the same issue - ActiveMQ works ok but for EMS, I get null.

It appears that org.apache.activemq.jndi.JNDIReferenceFactory and com.tibco.tibjms.naming.TibjmsObjectFactory behave differently.

Putting a break in the Tomcat ResourceFactory - they appear to be the same -

ActiveMQ and EMS both call

return factory.getObjectInstance

(obj, name, nameCtx, environment);

passing similar parameters but TibjmsObjectFactory returns null.

Much experimentation and Googling has failed to show a solution. (other than writing a custom Factory which I don't want to do).

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 years later...
  • 3 years later...

OK, this is a super-ancient question but I've been struggling with this for a few weeks now and thought it would be wise to post an answer just on case someone else needs a solution.

In short, with some introspection of the EMS JAR file, I've managed to stumble across a configuration that actually works, without the custom object factory that I thought I was going to need. The key piece of knowledge is that the Tibco EMS object factory that you need is calledcom.tibco.tibjms.naming.TibjmsAdministeredObjectFactory.

Here's an extract from my Tomcat server.xml where I define some objects globally:

 

 

 

 

 

 

 

 

 

So here I've bound a connection factory to name "jms/XXX_ConnectionFactory", and a queue to name"jms/XXX_Queue_In". You can also bind topics (using type="com.tibco.tibjms.TibjmsTopic") and various other XA connection factories.

Shame none of this gets a mention in the User Guide - well, not that I could find.

Link to comment
Share on other sites

×
×
  • Create New...