我正在尝试将 OpenLiberty 18.0.0.2 配置为使用嵌入式消息传递来发送一些简单的 JMS 消息。我的电流server.xml如下所示:<?xml version="1.0" encoding="UTF-8"?><server description="new server"> <featureManager> <feature>javaee-8.0</feature> <feature>mpConfig-1.2</feature> <feature>mpMetrics-1.1</feature> <feature>wasJmsServer-1.0</feature> <feature>wasJmsClient-2.0</feature> <feature>localConnector-1.0</feature> </featureManager> <quickStartSecurity userName="admin" userPassword="adminpwd" /> <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443" /> <applicationManager autoExpand="true" /> <applicationMonitor updateTrigger="mbean" /> <messagingEngine> <queue id="QUEUE1" /> </messagingEngine> <jmsQueueConnectionFactory jndiName="jms/JmsFactory"> <properties.wasJms remoteServerAddress="localhost:7276:BootStrapBasicMessaging" /> </jmsQueueConnectionFactory> <jmsQueue jndiName="jms/JmsQueue"> <properties.wasJms queueName="QUEUE1" /> </jmsQueue></server>我的 JMS 发件人如下所示:public class JmsMessageSender { @Resource(mappedName = "jms/JmsFactory") private ConnectionFactory jmsFactory; @Resource(mappedName = "jms/JmsQueue") private Queue jmsQueue; public void send() { TextMessage message; try (Connection connection = jmsFactory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(jmsQueue)) { message = session.createTextMessage(); message.setText("Hello World!"); producer.send(message); } catch (JMSException e) { e.printStackTrace(); } }}当我运行我的应用程序时,当我尝试将消息发送到嵌入式消息传递队列时,出现以下异常:javax.jms.InvalidDestinationException: CWSIA0281E: The specified value null is not allowed for Destination.[err] at com.ibm.ws.sib.api.jms.impl.JmsDestinationImpl.checkNativeInstance(JmsDestinationImpl.java:993)[err] at [internal classes]看起来我的代码无法通过JNDI. 我是否错误地配置了嵌入式消息,或者是我的源代码中的错误?
添加回答
举报
0/150
提交
取消