Я создаю JMS-провайдера в WAS 8.5 с ActiveMQ, но при отправке сообщений в очередь я получаю ошибку ниже.
javax.resource.spi.ResourceAllocationException: ConnectionFactory не найден в JNDI
Я создал фабрику соединений и очередь после ответа ниже:
ActiveMQ 5.11 с WebSphere Application Server 8.5
Когда я непосредственно отправляю сообщение в ActiveMQ, оно ставит в очередь мое сообщение.
InitialContext initialContext = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSession queueSession = null;
Queue queue = null;
QueueReceiver queueReceiver = null;
QueueSender queueSender = null;
String queueCF = "jms/ActiveMQCF";
String queueName = "queue/ActiveMQueue";
String message = "testJMS3";
TextMessage textMessage = null;
String messageID = null;
try {
initialContext = new InitialContext();
queueConnectionFactory = (QueueConnectionFactory) initialContext.lookup(queueCF);
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queue = (Queue) initialContext.lookup(queueName);
queueSender = queueSession.createSender(queue);
textMessage = queueSession.createTextMessage();
textMessage.setText(message);
queueSender.send(textMessage);
messageID = textMessage.getJMSMessageID();
} catch (Exception e) {
e.printStackTrace();
return e.getMessage();
}
com.ibm.ejs.jms.JMSCMUtils.mapToJMSException (JMSCMUtils.java:140), com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle.createQueueConnection (JMSQueueConnectionFactoryH.AddressBook.java:159), sun.reflect.NativeMethodAccessorImpl.invoke0 (родной метод), sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:90), sun.reflect.DelegatingMetholjotItJotIjingIvor.lang.reflect.Method.invoke (Method.java:508), org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest (InvokeMethodHandler.java:63), org.apache.wink.server.handlers.AbstractHandler.handleRequest (AbstractHandler.java:33), org.apache.wink.server.handlers.RequestHandlersChain.handle (RequestHandlersChain.java:26), org.apache.wink.server.handlers.RequestHandlersChain.handle (RequestHandlersChain.java:22), org.apache.wink.server.handlers.AbstractHandlersChain.doChain (AbstractHandlersChain.java:75), org.apache.wink.ser..handlers.CreateInvocationParametersHandler.handleRequest (CreateInvocationParametersHandler.java:54)