问题描述
我正在尝试建立连接到Artemis的WLS(12.1.3)桥,但是在使其工作方面遇到了问题。我认为我的问题可能出在我在WebLogic中配置桥接目标的方式,但无法弄清楚!
问题Error "Invalid broker URL" while bridging ActiveMQ Artemis 7.4 with Weblogic 12.x非常相似。他们似乎设法成功了,但是我想念一些关键细节!
我到目前为止所做的是:
-
在WebLogic域“ lib”文件夹中添加了“ artemis-jms-client-all-2.13.0.jar”和“ jndi.properties”
-
修改了WLS启动脚本,以使“ jndi.properties”位于类路径上,并通过在启动日志中检查“ java.class.path”的输出来确认已将其选中。
-
jndi.properties具有以下内容:
java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
connectionFactory.ConnectionFactory=tcp://myArtemisServer:61616?type=XA_CF
<jms-bridge-destination>
<name>artemis_endpoint</name>
<adapter-jndi-name>eis.jms.WLSConnectionFactoryJNDIXA</adapter-jndi-name>
<user-name>myUser</user-name>
<user-password-encrypted>XXXXXXXXXXXXXXXXXXXXXX</user-password-encrypted>
<connection-factory-jndi-name>ConnectionFactory</connection-factory-jndi-name>
<initial-context-factory>org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory</initial-context-factory>
<connection-url>tcp://myArtemisServer:61616?type=XA_CF</connection-url>
<destination-jndi-name>MY.ADDRESS::my/queue/jndi/name</destination-jndi-name>
</jms-bridge-destination>
-
地址和队列jndi是在“ myArtemisServer”中静态定义的
-
在WebLogic启动时出现此错误,并一遍又一遍地重复:
####<13-Aug-2020 12:56:46 o'clock IST> <Debug> <MessagingBridgeRuntime> <localhost> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1597319806108> <BEA-000000> <Bridge Getting target connection>
####<13-Aug-2020 12:56:46 o'clock IST> <Debug> <MessagingBridgeRuntimeVerbose> <localhost> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1597319806115> <BEA-000000> <Exception:
javax.naming.NameNotFoundException: ConnectionFactory
at org.apache.activemq.artemis.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:236)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at weblogic.jms.adapter.JMSBaseConnection$2.run(JMSBaseConnection.java:301)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.jms.adapter.JMSBaseConnection.startInternal(JMSBaseConnection.java:299)
at weblogic.jms.adapter.JMSBaseConnection.start(JMSBaseConnection.java:256)
at weblogic.jms.adapter.JMSManagedConnectionFactory.createManagedConnection(JMSManagedConnectionFactory.java:192)
at weblogic.connector.security.layer.AdapterLayer.createManagedConnection(AdapterLayer.java:843)
at weblogic.connector.outbound.ConnectionFactory.createResource(ConnectionFactory.java:91)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1331)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:425)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:344)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:324)
at weblogic.connector.outbound.ConnectionPool.reserveResource(ConnectionPool.java:705)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:318)
at weblogic.connector.outbound.ConnectionManagerImpl.getConnectionInfo(ConnectionManagerImpl.java:409)
at weblogic.connector.outbound.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:343)
at weblogic.connector.outbound.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:134)
at weblogic.jms.adapter.JMSBaseConnectionFactory.getTargetConnection(JMSBaseConnectionFactory.java:123)
at weblogic.jms.bridge.internal.MessagingBridge.getConnections(MessagingBridge.java:880)
at weblogic.jms.bridge.internal.MessagingBridge.run(MessagingBridge.java:1079)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
******************更新*************
摆脱jndi.properties并将网桥配置更改为
<connection-factory-jndi-name>XAConnectionFactory</connection-factory-jndi-name>
新错误,完整堆栈跟踪为
javax.naming.NamingException: scheme MY.ADDRESS not recognized
at org.apache.activemq.artemis.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:222)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at weblogic.jms.adapter.JMSBaseConnection$3.run(JMSBaseConnection.java:326)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.jms.adapter.JMSBaseConnection.startInternal(JMSBaseConnection.java:324)
at weblogic.jms.adapter.JMSBaseConnection.start(JMSBaseConnection.java:256)
at weblogic.jms.adapter.JMSManagedConnectionFactory.createManagedConnection(JMSManagedConnectionFactory.java:192)
at weblogic.connector.security.layer.AdapterLayer.createManagedConnection(AdapterLayer.java:843)
at weblogic.connector.outbound.ConnectionFactory.createResource(ConnectionFactory.java:91)
at weblogic.common.resourcepool.ResourcePoolImpl.makeResources(ResourcePoolImpl.java:1331)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResourceInternal(ResourcePoolImpl.java:425)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:344)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:324)
at weblogic.connector.outbound.ConnectionPool.reserveResource(ConnectionPool.java:705)
at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:318)
at weblogic.connector.outbound.ConnectionManagerImpl.getConnectionInfo(ConnectionManagerImpl.java:409)
at weblogic.connector.outbound.ConnectionManagerImpl.getConnection(ConnectionManagerImpl.java:343)
at weblogic.connector.outbound.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:134)
at weblogic.jms.adapter.JMSBaseConnectionFactory.getTargetConnection(JMSBaseConnectionFactory.java:123)
at weblogic.jms.bridge.internal.MessagingBridge.getConnections(MessagingBridge.java:880)
at weblogic.jms.bridge.internal.MessagingBridge.run(MessagingBridge.java:1079)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:553)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
>
在Artemis中定义的队列如下:
<address name="MY.ADDRESS">
<anycast>
<queue name="my/queue/jndi/name" />
</anycast>
</address>
解决方法
由于您在type=XA_CF
中使用connection-url
,因此XAConnectionFactory
应该使用connection-factory-jndi-name
。
关于NamingException
的{{1}},是否有特定的原因使您使用标准队列名称(即destination-jndi-name
)?如the documentation中所讨论的,通常,您会将JMS客户端的队列名称和地址名称配置为相同,以便生产者使用者可以使用相同的值,这通常不会给应用程序开发人员造成混乱。 FQQN通常保留用于特殊用例。此外,JNDI查找直到2.15.0才支持FQQN语法(请参见ARTEMIS-2880)。因此,我建议您在Artemis的<address>::<queue>
中使用类似的方法:
broker.xml
此外,由于您无法选择在JNDI环境属性中配置JMS目标,因此应使用the documentation中讨论的前缀<address name="myJmsDestination">
<anycast>
<queue name="myJmsDestination" />
</anycast>
</address>
。
最终,您的配置将如下所示:
dynamicQueues/
最后,我不认为您实际上需要<jms-bridge-destination>
<name>artemis_endpoint</name>
<adapter-jndi-name>eis.jms.WLSConnectionFactoryJNDIXA</adapter-jndi-name>
<user-name>myUser</user-name>
<user-password-encrypted>XXXXXXXXXXXXXXXXXXXXXX</user-password-encrypted>
<connection-factory-jndi-name>XAConnectionFactory</connection-factory-jndi-name>
<initial-context-factory>org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory</initial-context-factory>
<connection-url>tcp://myArtemisServer:61616?type=XA_CF</connection-url>
<destination-jndi-name>dynamicQueues/myJmsDestination</destination-jndi-name>
</jms-bridge-destination>
文件。所有必需的属性都可以直接在jndi.properties
中定义。