wildfly / jboss-eap:如何命名 JMS 资源以匹配 EJB2 ejb-jar.xml

wildfly / jboss-eap: How to name JMS resources to match EJB2 ejb-jar.xml

我目前将 EJB2 应用程序迁移到 jboss-eap。第一阶段尽量少修改源码

ejb-jar.xml包含

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
      [...]
      <session >

         [...]

         <resource-ref >
            <res-ref-name>jms/customQueueFactory</res-ref-name>
            <res-type>javax.jms.QueueConnectionFactory</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>

         <resource-env-ref >
            <resource-env-ref-name>jms/customQueue</resource-env-ref-name>
            <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
         </resource-env-ref>

      </session>

我将以下配置添加到 standalone-full.xml urn:jboss:domain:messaging-activemq:13.0:

  <connection-factory name="customQueueFactory" entries="java:/jms/customQueueFactory" connectors="in-vm"/>
  <jms-queue name="customQueue" entries="java:/jms/customQueue"/>

但是当我启动时jboss jms 资源无法解析:

02:26:30,651 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "app.ear")]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.naming.context.java.jboss.resources.jms.customQueueFactory",
        "jboss.naming.context.java.jboss.resources.jms.customQueue"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueueFactory is missing [jboss.naming.context.java.jboss.resources.jms.customQueueFactory]",
        "jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueue is missing [jboss.naming.context.java.jboss.resources.jms.customQueue]"
    ]
}

jboss-eap 7.4 的默认查找前缀是 java:jboss/resources。因此,为了使其正常工作,需要相应地调整导出的名称:

  <connection-factory name="customQueueFactory" entries="java:jboss/resources/jms/customQueueFactory" connectors="in-vm"/>
  <jms-queue name="customQueue" entries="java:jboss/resources/jms/customQueue"/>