问题描述
1、com.ibm.ws.naming.util.HelpersWARNING:jndiGetObjInstNoopExceptioninthread"P=451515:O=0:CT"java.lang.ClassCastException:javax.naming.Referenceincompatiblewithjavax.jms.QueueConnectionFactoryatcom.ztesoft.oss.js.flowbus.client.Test.sendJms(Test.java:146)atcom.ztesoft.oss.js.flowbus.client.Test.main(Test.java:93)代码如下:privatevoidsendJms(Stringxml)throwsException{QueueConnectionqueueConnection=null;//ConnectionqueueConnection=null;QueueBrowserqueueSender=null;QueueSessionqueueSession=null;try{logger.info("FACTORY_INITIAL:"+FACTORY_INITIAL);Contextcontext=NamingHelper.singleton().getInitialContext(FACTORY_INITIAL,PROVIDER_URL,null,null,null);QueueConnectionFactoryqueueConnectionFactory=(QueueConnectionFactory)context.lookup(FACTORY_NAME);//ConnectionFactoryqueueConnectionFactory=(javax.jms.ConnectionFactory)context.lookup(FACTORY_NAME);//javax.jms.ConnectionFactorylogger.info("队列的地址:"+PROVIDER_URL);logger.debug("获取队列连接工厂成功");logger.info("queueConnectionFactoryOKFACTORY_NAME="+FACTORY_NAME);queueConnection=queueConnectionFactory.createQueueConnection();//queueConnection=queueConnectionFactory.createConnection();logger.debug("连接队列工厂成功");queueConnection.start();queueSession=queueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);//queueSession=(QueueSession)queueConnection.createSession(false,Session.AUTO_ACKNOWLEDGE);Messagemessage=queueSession.createTextMessage(xml);//发送消息到mdbjavax.jms.Queuequeue=(javax.jms.Queue)context.lookup(QUEUE_NAME);logger.debug("获取队列成功");logger.info("context.lookup(QUEUE_NAME)OKQUEUE_NAME="+QUEUE_NAME);queueSender=(QueueBrowser)queueSession.createSender(queue);logger.debug("发送的消息为:"+xml);((QueueSender)queueSender).send(message);logger.debug("发送消息成功");}finally{if(queueSender!=null){try{queueSender.close();}catch(JMSExceptionex1){}}if(queueSession!=null){try{queueSession.close();}catch(JMSExceptionex2){}}if(queueConnection!=null){try{queueConnection.close();}catch(JMSExceptionex3){}}}}在本地直接调用,使用的是IBM的JDK。
解决方案
解决方案二:
运行在什么服务器上的?