Manoj Chaurasia Posted April 24, 2012 Share Posted April 24, 2012 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 More sharing options...
Manoj Chaurasia Posted March 20, 2014 Author Share Posted March 20, 2014 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 More sharing options...
Manoj Chaurasia Posted April 1, 2014 Author Share Posted April 1, 2014 Any luck with this, anybody Link to comment Share on other sites More sharing options...
Manoj Chaurasia Posted June 7, 2016 Author Share Posted June 7, 2016 I add myself. I cannot either use such an EMS configuration Link to comment Share on other sites More sharing options...
Steve Higgins Posted April 16, 2020 Share Posted April 16, 2020 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 More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now