2 Replies Latest reply on May 12, 2009 1:57 PM by leoaxi

    Getting "JMS-112: Connection is invalid" while using an JNDI

    yclian

      Hi all,

      One of our customers is facing this issue, which I am able to reproduce at my end as well. I have a JBoss 4.2.2 GA which is exposing an Oracle DS:

      <datasources>
       <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name>
       <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>jboss</user-name>
       <password>password</password>
       <use-java-context>false</use-java-context>
       </local-tx-datasource>
      </datasources>


      At another end, I have a Mule which looks up the DataSource via JNDI and uses it for Oracle AQ. When Mule tries to get the queue connection, an error occurs:

      Caused by: oracle.jms.AQjmsException: JMS-112: Connection is invalid
      at oracle.jms.AQjmsError.throwEx(AQjmsError.java:288)
      at oracle.jms.AQjmsDBConnMgr.extraInit(AQjmsDBConnMgr.java:782)
      at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:354)
      at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:223)
      at oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection(AQjmsQueueConnectionFactory.java:340)
      at org.mule.providers.oracle.jms.OracleJmsConnection.getQueueConnection(OracleJmsConnection.java:132)
      


      Our customer has also contacted JBoss regarding this matter, and this the response that he received from the folks:

      " The error you have is because you are using a wrapped connection comming out of the datasource. We need to find a way to get the oracle connection and use that. "


      I have inspected the code, and found that the returned object from the JDNI look-up is a http://docs.jboss.org/jbossas/javadoc/4.0.2/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxy.java.html. :

      "lookedUp"= $Proxy0 (id=32)
       h= ClientContainer (id=39)
       context= InvocationContext (id=47)
       context= HashMap<K,V> (id=54)
       entrySet= HashMap$EntrySet (id=58)
       this$0= HashMap<K,V> (id=54)
       keySet= null
       loadFactor= 0.75
       modCount= 0
       size= 3
       table= HashMap$Entry<K,V>[16] (id=66)
       [0]= null
       [1]= null
       [2]= null
       [3]= null
       [4]= HashMap$Entry<K,V> (id=1021)
       hash= -957407340
       key= InvocationKey (id=1022)
       name= "CACHE_ID"
       ordinal= 5
       next= null
       value= null
       [5]= null
       [6]= null
       [7]= null
       [8]= null
       [9]= null
       [10]= null
       [11]= null
       [12]= null
       [13]= HashMap$Entry<K,V> (id=1023)
       hash= 2100754445
       key= InvocationKey (id=1026)
       name= "CONTAINER"
       ordinal= 3
       next= null
       value= Integer (id=1027)
       value= 1964300194
       [14]= HashMap$Entry<K,V> (id=1024)
       hash= -1328126498
       key= InvocationKey (id=1029)
       name= "INVOKER"
       ordinal= 11
       next= null
       value= JRMPInvokerProxy (id=1030)
       remoteInvoker= JRMPInvoker_Stub (id=1032)
       ref= UnicastRef2 (id=1033)
       ref= LiveRef (id=1034)
       ch= null
       ep= TCPEndpoint (id=1035)
       csf= null
       host= "127.0.0.1"
       port= 4444
       ssf= null
       transport= null
       id= ObjID (id=1036)
       objNum= 1
       space= UID (id=1040)
       count= -32768
       time= 1202988535078
       unique= -1924191110
       isLocal= false
       [15]= null
       threshold= 12
       values= null
       next= ClientMethodInterceptor (id=49)
       nextInterceptor= InvokerInterceptor (id=967)
       invokerID= GUID (id=968)
       hashCode= -464387998
       uid= UID (id=970)
       id= 2
       time= 1202988535796
       vmid= VMID (id=971)
       address= byte[4] (id=1041)
       hashCode= -464388000
       pid= PID (id=1042)
       uid= UID (id=1049)
       nextInterceptor= null
       remoteInvoker= null
      


      Anyone can advice on how I can get the real connection factory? Cheers.