gpt4 book ai didi

java - Wildfly 10 Final JMS 所需的服务未安装

转载 作者:太空宇宙 更新时间:2023-11-04 12:06:02 24 4
gpt4 key购买 nike

我有一个使用 Wildfly 10 Final 和 JSF 2.2.9 的动态 Web 项目。我尝试通过消息驱动 Bean 发送消息。

但是,如果我尝试在 Wildfly 上启动 Web 应用程序,则会收到以下错误:

23:57:53,971 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MyApplication.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.MyApplication.MyApplication.env.jms.queue.WebSocketDrivenQueue"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.MyApplication.MyApplication.env.\"com.example.QueueSenderSessionBean\".myQueue is missing [jboss.naming.context.java.module.MyApplication.MyApplication.env.jms.queue.WebSocketDrivenQueue]"]
}
23:57:54,270 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "MyApplication.war" (runtime-name : "MyApplication.war")
23:57:54,273 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.naming.context.java.module.MyApplication.MyApplication.env.jms.queue.WebSocketDrivenQueue (missing) dependents: [service jboss.naming.context.java.module.MyApplication.MyApplication.env."com.example.QueueSenderSessionBean".myQueue]

WebSocketDrivenBean

@MessageDriven(
activationConfig = { @ActivationConfigProperty(
propertyName = "destination", propertyValue = "java:/jms/queue/WebSocketDrivenQueue"), @ActivationConfigProperty(
propertyName = "destinationType", propertyValue = "javax.jms.Queue")
},
mappedName = "java:/jms/queue/WebSocketDrivenQueue")
@Named
public class WebSocketDriven implements MessageListener {
@Inject
@WSJMSMessage
Event<Message> jmsEvent;

public WebSocketDriven() {
}

public void onMessage(Message message) {
jmsEvent.fire(message);
}
}

QueueSenderSessionBean

@Stateless
public class QueueSenderSessionBean {

@Resource(mappedName = "java:/jms/queue/WebSocketDrivenQueue")
private Queue myQueue;
@Inject
private JMSContext jmsContext;

public void sendMyText(String message){
jmsContext.createProducer().send(myQueue, message);
}
}

以及尝试发送消息的类:

@Named  
@ClientEndpoint(encoders={JsonEncoder.class}, decoders={JsonDecoder.class})
public class MyTestApplication implements Serializable{
private static final long serialVersionUID = 1L;
Session userSession = null;

@Inject
private QueueSenderSessionBean senderBean;

....

@OnMessage
public void onMessage(WebSocketMessage message) {
this.senderBean.sendMyText("Hello");
}
....
}

我使用 JMS 支持的standalone-full.xml 启动了 WildFly 服务器,并插入了以下行:

<jms-queue name="WebSocketDrivenQueue" entries="java:/jms/queue/WebSocketDrivenQueue />

有人可以帮我吗?是否存在配置错误或类似问题?

谢谢。谨致问候。

最佳答案

对于 DJTust,我在调用 jmsContext.createProducer().send(queue, "Hello") 后找到了解决 NullPointer 的答案。您还必须添加 beans.xml。请参阅 Nikolai Schreier 的回答 JMSContext NullPointer Exception - wildfly 8.2.0 default queue

关于java - Wildfly 10 Final JMS 所需的服务未安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40352001/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com