Reputation: 75
I'm trying to set up a WLS (12.1.3) bridge connecting into Artemis and am have issues getting it working. I think my problem may be in the way I'm configuring the bridge destination in WebLogic, but can't figure it out!
The question Error "Invalid broker URL" while bridging ActiveMQ Artemis 7.4 with Weblogic 12.x is pretty similar. They seemed to have managed to get it working, but I'm missing some key detail I think!
What I've done so far is:
added "artemis-jms-client-all-2.13.0.jar" and "jndi.properties" to WebLogic domain "lib" folder
Modified WLS start-up script so that "jndi.properties" is on classpath and confirmed this is being picked up by checking output of "java.class.path" in the start-up logs
jndi.properties has the following:
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>
addresses and queue jndi are statically defined in "myArtemisServer"
on WebLogic startup am getting this error, repeating over and over:
####<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)
****************** update *************
after getting rid of jndi.properties and changing bridge configuration to
<connection-factory-jndi-name>XAConnectionFactory</connection-factory-jndi-name>
New error, full stack trace is
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)
>
With queue defined in Artemis like this:
<address name="MY.ADDRESS">
<anycast>
<queue name="my/queue/jndi/name" />
</anycast>
</address>
Upvotes: 0
Views: 1561
Reputation: 35217
Since you're using type=XA_CF
in your connection-url
you should use XAConnectionFactory
for the connection-factory-jndi-name
.
Regarding the NamingException
for the destination-jndi-name
, is there a specific reason you're using the fully-qualified-queue name (i.e. <address>::<queue>
)? As discussed in the documentation typically you'd configure the queue name and address name to be the same for JMS clients so that the producer consumer could use the same value which is generally less confusing for application developers. The FQQN is generally reserved for special use-cases. Furthermore, FQQN syntax wasn't supported for JNDI lookups until 2.15.0 (see ARTEMIS-2880). Therefore, I recommend you use something like this in Artemis' broker.xml
:
<address name="myJmsDestination">
<anycast>
<queue name="myJmsDestination" />
</anycast>
</address>
Also, since you don't have the option to configure the JMS destination in JNDI environment properties you should use the dynamicQueues/
prefixed as discussed in the documentation.
Ultimately your configuration would look something like this:
<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>
Lastly, I don't believe you actually need the jndi.properties
file. All the necessary properties can be defined directly in the jms-bridge-destination
.
Upvotes: 1