无法使用glassfish-resources.xml在Glassfish v3.1.2中创建JMS资源

时间:2013-05-24 15:43:44

标签: java jms glassfish-3

我在Glassfish服务器上的Action上尝试了EJB3的chapter4示例。我在ear包的META-INF目录下打包了下面的glassfish-resources.xml(使用netbeans创建)。但是,无法部署错误“未创建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>

1 个答案:

答案 0 :(得分: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"/>