3 Replies Latest reply on Nov 28, 2008 12:56 PM by Tim Fox

    NullPointerException while setting Bridge

    Yogesh Patil Newbie

      Hi,
      I'm configuring jboss messaging bridge. Both the source and destination are jboss messaging 1.4 which are deployed on jboss-eap 4.3.
      I have configured a Remote JMSProvider in jms-ds.xml as:

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=Another">
       <attribute name="ProviderName">RemoteJMSProvider</attribute>
       <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
       <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jnp.interfaces
       java.naming.provider.url=anotherjboss:1099
       </attribute>
       <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
       <!-- The topic factory -->
       <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
       </mbean>
      

      This is the only change I have done to configure bridge apart from actual Bridge mbean config. which is :
       <mbean code="org.jboss.jms.server.bridge.BridgeService"
       name="jboss.messaging:service=Bridge,name=BridgeToRemote"
       xmbean-dd="xmdesc/Bridge-xmbean.xml">
      
       <depends optional-attribute-name="SourceProviderLoader">
       jboss.messaging:service=JMSProviderLoader,name=LocalJMSProvider</depends>
      
       <depends optional-attribute-name="TargetProviderLoader">
       jboss.mq:service=JMSProviderLoader,name=RemoteJMSProvider,server=Another</depends>
      
       <attribute name="SourceDestinationLookup">/queue/A</attribute>
      
       <attribute name="TargetDestinationLookup">/queue/B</attribute>
      
       <attribute name="SourceUsername">user1</attribute>
       <attribute name="SourcePassword">pwd1</attribute>
      
       <attribute name="TargetUsername">user2</attribute>
       <attribute name="TargetPassword">pwd2</attribute>
      
      
       <!-- Optional: The Quality Of Service mode to use, one of:
       QOS_AT_MOST_ONCE = 0;
       QOS_DUPLICATES_OK = 1;
       QOS_ONCE_AND_ONLY_ONCE = 2; -->
       <attribute name="QualityOfServiceMode">2</attribute>
      
       <attribute name="MaxBatchSize">5</attribute>
      
       <attribute name="MaxBatchTime">-1</attribute>
      
       <attribute name="FailureRetryInterval">50000</attribute>
      
       <attribute name="MaxRetries">-1</attribute>
      
       <attribute name="AddMessageIDInHeader">false</attribute>
      
       </mbean>
      


      Another jboss is up and running but the bridge is unable to connect. I get a NPE like this:
      12:12:41,250 WARN [Bridge] Failed to set up connections
      java.lang.NullPointerException
      at javax.naming.InitialContext.getURLScheme(InitialContext.java:228)
      at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.jms.server.bridge.JNDIFactorySupport.createObject(JNDIFactorySupport.java:66)
      at org.jboss.jms.server.bridge.JNDIConnectionFactoryFactory.createConnectionFactory(JNDIConnectionFactoryFactory.java:46)
      at org.jboss.jms.server.bridge.Bridge.createConnection(Bridge.java:832)
      at org.jboss.jms.server.bridge.Bridge.setupJMSObjects(Bridge.java:944)
      at org.jboss.jms.server.bridge.Bridge.setupJMSObjectsWithRetry(Bridge.java:1152)
      at org.jboss.jms.server.bridge.Bridge.access$1500(Bridge.java:66)
      at org.jboss.jms.server.bridge.Bridge$FailureHandler.run(Bridge.java:1507)
      at java.lang.Thread.run(Thread.java:595)

      I further checked for any problems and just BEFORE this exception I'm getting another exception in PropertyEditors from jboss util package. Here is the stack trace for that exception:

      12:21:05,341 TRACE [PropertyEditors] Failed to find property editor for: onewayThreadPool
      12:21:05,341 TRACE [PropertyEditors] Failed to write property
      java.lang.NullPointerException
      at org.jboss.util.propertyeditor.PropertyEditors.mapJavaBeanProperties(PropertyEditors.java:373)
      at org.jboss.remoting.transport.socket.SocketServerInvoker.setup(SocketServerInvoker.java:155)
      at org.jboss.remoting.transport.bisocket.BisocketServerInvoker.setup(BisocketServerInvoker.java:510)
      at org.jboss.remoting.ServerInvoker.create(ServerInvoker.java:836)
      at org.jboss.remoting.transport.Connector.init(Connector.java:430)
      at org.jboss.remoting.transport.Connector.create(Connector.java:777)
      at org.jboss.remoting.transport.Connector.start(Connector.java:301)
      at org.jboss.remoting.Client.addListener(Client.java:918)
      at org.jboss.jms.client.remoting.JMSRemotingConnection.addInvokerCallbackHandler(JMSRemotingConnection.java:230)
      at org.jboss.jms.client.remoting.JMSRemotingConnection.start(JMSRemotingConnection.java:340)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$createConnectionDelegate$aop(ClientConnectionFactoryDelegate.java:154)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.invokeNext(ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.java)
      at org.jboss.jms.client.container.StateCreationAspect.handleCreateConnectionDelegate(StateCreationAspect.java:83)
      at org.jboss.aop.advice.org.jboss.jms.client.container.StateCreationAspect0.invoke(StateCreationAspect0.java)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.invokeNext(ClientConnectionFactoryDelegate$createConnectionDelegate_N3019492359065420858.java)
      at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createConnectionDelegate(ClientConnectionFactoryDelegate.java)
      at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:205)
      at org.jboss.jms.client.JBossConnectionFactory.createXAConnection(JBossConnectionFactory.java:128)
      at org.jboss.jms.server.bridge.Bridge.createConnection(Bridge.java:858)
      at org.jboss.jms.server.bridge.Bridge.setupJMSObjects(Bridge.java:940)
      at org.jboss.jms.server.bridge.Bridge.setupJMSObjectsWithRetry(Bridge.java:1152)
      at org.jboss.jms.server.bridge.Bridge.access$1500(Bridge.java:66)
      at org.jboss.jms.server.bridge.Bridge$FailureHandler.run(Bridge.java:1507)
      at java.lang.Thread.run(Thread.java:595)

      I don't know if they are related, but still worth mentioning.
      Also as an additional info. Both Jboss are simple standard stand-alone configurations with no fail-over/clustering configured.

      why am I getting an NPE when Bridge is setting up connections?

      Cheers,

        • 1. Re: NullPointerException while setting Bridge
          Yogesh Patil Newbie

          Just to add to the above topic, I have tried specifying protocol on the remote jboss JNDI url.
          That is to say in RmoteJMSProvier configuration in Properties Attribute I have tried to put
          java.naming.provider.url=jnp://anotherjboss:1099
          But the problem and exceptions remain exactly same.

          Thought, this point would come up pretty soon, so tested it before hand.

          Cheers,

          • 2. Re: NullPointerException while setting Bridge
            Yogesh Patil Newbie

            Ok guys, found out on my own, a rather dumb mistake on my part:
            In RemoteJMSProvider configuration, I forgot to add attribute FactoryRef, i.e.

            <!-- The combined connection factory -->
             <attribute name="FactoryRef">XAConnectionFactory</attribute>


            I added it and everything went smoothly!

            I still have one more dumb question though, if anybody can take time to enlighten me:
            Why I need to specify this "Combined Connection Factory" attribute?
            Well, as you can guess, I'm pretty newbie here, and so I am not to able to figure out why this is MANDATORY and why the bridge collapses before it is even made if this is not specified and that too with NPE?

            Thanks anyway!

            • 3. Re: NullPointerException while setting Bridge
              Tim Fox Master

               

              "YogeshGLX" wrote:

              Why I need to specify this "Combined Connection Factory" attribute?
              Well, as you can guess, I'm pretty newbie here, and so I am not to able to figure out why this is MANDATORY and why the bridge collapses before it is even made if this is not specified and that too with NPE?



              All that stuff is JCA configuration, not JBoss Messaging configuration. I'd suggest asking in the JCA forum.