gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 14:32:39 25 4
gpt4 key购买 nike

我正在尝试 chapter4 上的示例在 Glassfish 服务器上运行的 EJB3。我已将以下 glassfish-resources.xml (使用 netbeans 创建)打包在ear包的META-INF目录下。但是,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>

最佳答案

您缺少实际创建 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"/>

关于java - 无法使用 glassfish-resources.xml 在 Glassfish v3.1.2 中创建 JMS 资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16738828/

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