title: Error "Invalid broker URL" while bridging ActiveMQ Artemis 7.4 with Weblogic 12.x
body: <p>I am trying to create bridge between Oracle 12.x and Redhat ActiveMQ Artemis 7.4. This is what has been done to set up the bridge:</p>
  
  <ol>
  <li>Set artemis-jms-client-all-2.9.0.redhat-00005.jar to WL classpath</li>
  <li>Set the following properties to WL classpath:</li>
  </ol>
  
  <pre><code>java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
  connectionFactory.ConnectionFactory=amq.xaqcf.myqueue
  queue.queues/myqueue=myqueue
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>java.lang.Exception: javax.resource.ResourceException: ConnectionFactory: failed to get initial context (InitialContextFactory =org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory, url = tcp://brokername:61616?type=XA_CF, user name = amq)
          at weblogic.jms.adapter.JMSBaseConnection.throwResourceException(JMSBaseConnection.java:1750)
          at weblogic.jms.adapter.JMSBaseConnection.startInternal(JMSBaseConnection.java:538)
          at weblogic.jms.adapter.JMSBaseConnection.start(JMSBaseConnection.java:264)
          at 
  ...
  -------------- Linked Exception ------------
  javax.naming.NamingException: Invalid broker URL
          at org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory.getInitialContext(ActiveMQInitialContextFactory.java:85)
  </code></pre>
  
  <p>According to <a href="https://github.com/apache/activemq-artemis/blob/master/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java" rel="nofollow noreferrer" title="ActiveMQInitialContextFactory.java">ActiveMQInitialContextFactory.java</a>, it is due to the following block:</p>
  
  <pre><code>for (Map.Entry&lt;?, ?&gt; entry : environment.entrySet()) {
      String key = entry.getKey().toString();
      if (key.startsWith(connectionFactoryPrefix)) {
          String jndiName = key.substring(connectionFactoryPrefix.length());
          try {
              data.put(jndiName, createConnectionFactory((String) environment.get(key), jndiName));
          } catch (Exception e) {
              e.printStackTrace();
              throw new NamingException("Invalid broker URL");
          }
      }
  }
  </code></pre>
  
  <p>Here's the exception from <code>e.printStackTrace()</code>:</p>
  
  <pre><code>Exception: javax.naming.NameNotFoundException: amq.xaqcf.myqueue
          at org.apache.activemq.artemis.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:236) 
          at javax.naming.InitialContext.lookup(InitialContext.java:417)
  </code></pre>
  
  <p>I have no issue bridging between Oracle Weblogic 12.x with ActiveMQ 6.3. A similar issue was raised here <a href="https://stackoverflow.com/questions/56835525/is-there-a-java-1-7-compatible-artemis-jms-client" title="Is there a Java 1.7 compatible Artemis JMS client?">Is there a Java 1.7 compatible Artemis JMS client?</a> but it is for Oracle SOA 10.x which uses java 1.7.</p>
  
  <p>How can I make it work? Should <a href="https://github.com/apache/activemq-artemis/blob/master/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ActiveMQInitialContextFactory.java" rel="nofollow noreferrer" title="ActiveMQInitialContextFactory.java">ActiveMQInitialContextFactory.java</a> be adapted?</p>