Here is my QueueConnectionFactory configuration:
Name: QueueConnFactory
JNDI name: jms/QueueConnFactory
Bus name: MyBus
Target inbound transport chain: InboundBasicMessaging
Provider endpoints: localhost:7276:BootstrapBasicMessaging
Connection procimity: Bus
XA recovery authentication alias: (none)
Here is my Queue configuration:
Name: TestMDBQueue
JNDI name: jms/MTestMDBQueue
BusName: MyBus
Delivery mode: Application
Read Ahead: Enabled
I have JMS activation specification which is set to the MDB that have to receive the messages. So when I send locally everything is ok. But when I send from application that is running outside of the WAS I have this exception:
2005-11-18 10:43:38 com.ibm.ws.naming.util.Helpers
WARNING: jndiNamingException
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is java.lang.NoClassDefFoundError: Invalid Implementation Key, com.ibm.ws.transaction.NonRecovWSTxManager
at com.ibm.ws.Transaction.TransactionManagerFactory.getUOWCurrent(TransactionManagerFactory.java:109)
at com.ibm.ws.rsadapter.AdapterUtil.<clinit>(AdapterUtil.java:125)
at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getObjectInstance(ConnectionFactoryBuilderImpl.java:225)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:314)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:874)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:681)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:1969)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1824)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1737)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1444)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1324)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at com.seeburger.appservtest.test.SimpleTest.sendMessageToQueue(SimpleTest.java:96)
at com.seeburger.appservtest.test.SimpleTest.main(SimpleTest.java:66)
Here is the code responsible for the exception: I could not lookup the QueueConnectionFactory.
InitialContext context = new InitialContext();
ConnectionFactory connectionFactory =
(ConnectionFactory)ctxArg.lookup(connectionFactoryJNDI); //HERE IS THE PLACE
//find queue
Queue queue = (Queue)ctxArg.lookup(queueJNDI);
//create connection
Connection conn = connectionFactory.createConnection();
conn.start();
//crate session
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
//create message producer and message
MessageProducer messProducer = session.createProducer(queue);
TextMessage textMessage = session.createTextMessage();
textMessage.setText(messageArg);
//send message
textMessage.setJMSDestination(queue);
messProducer.send(textMessage);
conn.stop();
I have jndi.properties file in the classpath with this configuration:
java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
java.naming.provider.url=iiop://localhost:2809
I am using the IBM JRE from the WAS. I tried to add the /properties folder from WAS instllation but this didn?t help. I also added naming*.jars and com.ibm.mq.jar and com.ibm.mqjms.jar. (The hole WAS/lib didn?t help too)
The strange is that when I put
Queue queue = (Queue)ctxArg.lookup(queueJNDI);
First before factory lookup it throws:
2005-11-18 10:57:41 com.ibm.ws.naming.util.Helpers
WARNING: jndiGetObjInstNoop
java.lang.ClassCastException: javax.naming.Reference
at com.seeburger.appservtest.test.SimpleTest.sendMessageToQueue(SimpleTest.java:100)
at com.seeburger.appservtest.test.SimpleTest.main(SimpleTest.java:66)
Which I suppose means that it can not find the implementation classes for the Queue after lookup, but what else should I add to the classpath? This is bugging me for a week and I really will appreciate if someone could help with advice.
Thanks in advanced, Jivko
Regards,
David
I was facing the same problem and dont know whether you were able to solve it.
I inlcuded the messageClient.jar from the lib folder to external jars and it worked for me.
Thanks,
Vijaya
WARNING: jndiGetObjInstNoop
java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.portable.ObjectImpl
at com.ibm.rmi.javax.rmi.PortableRemoteObject.getObjectImpl(PortableRemoteObject.java:620)
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:341)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
Any idea?