OK...let me add more information and it might pin point whats wrong...
The setup is as follows;
Custom File Listener --> Activates --> My Listener MDB --> Put Message On Queue say 'queue/testQueue' and I am getting jms not bound while creating a connection to the jms server randomly...as I mentioned earlier...sometime it works
I can clearly see in my MDB JNDI tree that resource is there...as follows;
Ejb Module: tocflistener-ejb.jar
java:comp namespace of the OFSListenerMDB bean:
+- UserTransaction (class: javax.transaction.UserTransaction)
+- env (class: org.jnp.interfaces.NamingContext)
| +- queue (class: org.jnp.interfaces.NamingContext)
| | +- t24OFSReplyQueue[link -> queue/t24OFSReplyQueue] (class: javax.naming.LinkRef)
| | +- t24OFSQueue[link -> queue/t24OFSQueue] (class: javax.naming.LinkRef)
| +- jms (class: org.jnp.interfaces.NamingContext)
| | +- jmsConnectionFactory[link -> java:/ConnectionFactory] (class: javax.naming.LinkRef)
the lokkup for jmsConnectionFactory resource is faling saying jms not bound.
And with my web application I have the same code doing the same job is working OK every time.
Let me know if above helps,
The problem was that the MDB was deployed as multiple instances and second instance did not define the resource-ref to the JMS Connction Factory and jboss mixed the class loader and first MDB was also not able to find the resource. Once the resources are added in the deployment descriptor everything works OK.
Hope this will help someone