0

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
  • in WebLogic config.xml, configured a JMS bridge destination like this (using this in a bridge "local2artemis" with a local queue as source and this artemis destination as target):
<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>
AdrianF
  • 75
  • 1
  • 6

1 Answers1

1

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.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Thanks very much Justin, that's helped me move along! However I think the way I am defining the "destination-jndi-name" to reference the queue is now incorrect - I'm getting a "scheme MY.ADDRESS not recognized" Naming exception. Any pointers on where to go from here greatly appreciated! – AdrianF Aug 13 '20 at 22:52
  • This is for a queue defined in Artemis like so, btw: ````
    ````
    – AdrianF Aug 13 '20 at 22:58
  • Thanks. I'm actually not fully sure why we're using addresses like that, will have to check with team. In any case, I've updated question with details and stack trace. Really appreciate the support! – AdrianF Aug 14 '20 at 00:03
  • I updated my answer to address your queue lookup issue. – Justin Bertram Aug 14 '20 at 14:40
  • Thanks very much, I was just about to come back and say I'd figured out the same myself. I think this could maybe be considered a bit of a bug in the client - I debugged it and saw it can't handle the fully qualified queue names with "::" because in ReadOnlyContext it assumes presence of colon means a scheme name (int pos = name.indexOf(':');). In any case, we'll move away from the way we were setting up our queues - we were trying to model the WebLogic "JMS Module" concept by using a single Address to group related queues, but I don't think it actually makes sense. Thanks once again!! – AdrianF Aug 14 '20 at 14:46
  • sorry - i see you are a step ahead of me once again, with ARTEMIS-2880 :) – AdrianF Aug 14 '20 at 14:49