问题
I am trying out the example on chapter4 of EJB3 in Action on Glassfish server. I have packaged the below glassfish-resources.xml (created with netbeans) under the META-INF directory of the ear package. However the ear fails to deploy with the error "JMS resource not created : ShippingRequestQueue". Please help me fix the issue.
Update: I am able to deploy resources xml file from admin console. But it doesn't get deployed along with the ear file.
<?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:
You are missing the admin-object-resource config that actually creates the JMS Queue. Your current config only creates the connection factory. You can try a modified configuration such as this:
<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"/>
来源:https://stackoverflow.com/questions/16738828/unable-create-jms-resources-in-glassfish-v3-1-2-using-glassfish-resources-xml