【发布时间】:2023-03-26 12:22:01
【问题描述】:
我对在 Thorntail 上配置 JMS 有一点问题。在我的开发项目中,我使用的是 Wildfly,但对于远程服务器,我们使用的是(我的团队)IBM Portal。我将本地服务器从 Wildfly 升级到 Thorntail,在我想在本地启动我的应用程序(使用 maven)后,它崩溃了。我查看了日志,发现它给出了我的:
2019-12-04 10:49:50,957 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("add") failed - address: (("deployment" => "myproject.war")) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.myproject.env.jms.notification"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".connectionFactory is missing [jboss.naming.context.java.module.myproject.env.jms.notification]",
"jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".topic is missing [jboss.naming.context.java.module.myproject.env.jms.notification]"
]
}
2019-12-04 10:49:50,994 ERROR [org.jboss.as.server] (main) WFLYSRV0021: Deploy of deployment "myproject.war" was rolled back with the following failure message:
{
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.myproject.env.jms.notification"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".connectionFactory is missing [jboss.naming.context.java.module.myproject.env.jms.notification]",
"jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".topic is missing [jboss.naming.context.java.module.myproject.env.jms.notification]"
]
}
在我们的本地环境中,我们没有为 JMS 配置任何队列,因为我们的主要队列机制位于远程服务器(IBM 门户)上。 我们正在使用一些代码:
public class JmsNotificationServiceImpl implements JmsNotificationService {
@Resource(lookup = "jms/notificationCF")
private ConnectionFactory connectionFactory;
@Resource(lookup = "jms/topic/notification")
private Topic topic;
@Override
public void send(String string) throws Exception {
Connection connection = null;
try {
connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(topic);
log.info("Sending JMS message to topic...");
producer.send(session.createObjectMessage(string));
log.info("Message sent succesfull.");
} catch (JMSException e) {
throw new Exception("Error while creation or sending jms message", e);
}
}
}
我发现Thorntail中有ActiveMQ中的build,但是我真的不知道如何在ActiveMQ中配置ConnectionFactory和Topic。谁能帮我了解一些配置放在哪里以及如何配置它?
【问题讨论】:
-
能分享一下WildFly的
standalone.xml配置的相关部分吗?将其转换为 Thorntailproject-defaults.yml应该非常简单。虽然老实说,我认为与 WildFly 保持联系对您的目的会更好,因为它可能与目标环境非常接近。 -
你能告诉我在哪里可以找到这个standalone.xml 文件吗?我在github上发现了一些随机项目,有一个project-defaults.yml,但我怎么理解,它是用于Thorntail和ActiveMQ(例如远程)之间的通信,但我想使用内置的activeMQ。那么你知道如何在内置的activeMQ中配置ConnectionFactory和Topic吗?
-
好的,那么在您的 WildFly 设置中,您没有配置内置的 Artemis 服务器并使用远程消息服务器?但是在您的 Thorntail 设置中,您想使用内置的 ActiveMQ Artemis 消息服务器吗?这是一个简单的测试用例,展示了绝对的基础知识:github.com/rhoar-qe/thorntail-test-suite/tree/master/javaee/…
-
需要明确的是,我没有使用任何特殊配置来使用 Artemis。我看到分数自动检测添加我自动按摩分数,这是。
标签: java jakarta-ee jms wildfly thorntail