0

我正在尝试Glassfish 服务器上的 EJB3 的第 4章中的示例。我已经在ear包的META-INF目录下打包了下面的glassfish-resources.xml(用netbeans创建)。但是,ear 无法部署并出现错误“未创建 JMS 资源: ShippingRequestQueue”。请帮我解决问题。

更新:我能够从管理控制台部署资源 xml 文件。但它不会与 ear 文件一起部署。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
    <admin-object-resource enabled="true"
        jndi-name="jms/ShippingRequestQueue" object-type="user" res-adapter="jmsra"
        res-type="javax.jms.Queue">
        <description />
        <property name="Name" value="ShippingRequestQueue"></property>
    </admin-object-resource>
    <connector-resource enabled="true" jndi-name="jms/ConnectionFactory"
        object-type="user" pool-name="jms/ConnectionFactory">
        <description />
    </connector-resource>
    <connector-connection-pool
        associate-with-thread="false" connection-creation-retry-attempts="0"
        connection-creation-retry-interval-in-seconds="10"
        connection-definition-name="javax.jms.ConnectionFactory"
        connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
        fail-all-connections="false" idle-timeout-in-seconds="300"
        is-connection-validation-required="false" lazy-connection-association="false"
        lazy-connection-enlistment="false" match-connections="true"
        max-connection-usage-count="0" max-pool-size="32"
        max-wait-time-in-millis="60000" name="jms/ConnectionFactory"
        pool-resize-quantity="2" resource-adapter-name="jmsra"
        steady-pool-size="8" validate-atmost-once-period-in-seconds="0" />
</resources>
4

1 回答 1

1

您缺少实际创建 JMS 队列的 admin-object-resource 配置。您当前的配置仅创建连接工厂。您可以尝试修改配置,例如:

  <admin-object-resource res-adapter="jmsra" res-type="javax.jms.Queue" description="shipping request queue" jndi-name="jms/ShippingRequestQueue">
    <property name="Name" value="ShippingRequestQueue" />  
  </admin-object-resource> 

  <connector-resource enabled="true" jndi-name="jms/ShippingRequestConnectionPool" object-type="user" pool-name="jms/ShippingRequestConnectionPool">
    <description/>
  </connector-resource>
  <connector-connection-pool associate-with-thread="false" connection-creation-retry-attempts="0" 
                             connection-creation-retry-interval-in-seconds="10" connection-definition-name="javax.jms.QueueConnectionFactory" 
                             connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" 
                             fail-all-connections="false" idle-timeout-in-seconds="300" 
                             is-connection-validation-required="false" lazy-connection-association="false" 
                             lazy-connection-enlistment="false" match-connections="true" 
                             max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" 
                             name="jms/ShippingRequestConnectionPool" pool-resize-quantity="2" 
                             resource-adapter-name="jmsra" steady-pool-size="8" 
                             validate-atmost-once-period-in-seconds="0"/> 
于 2013-05-24T23:05:59.657 回答