1 Reply Latest reply on Nov 8, 2005 10:12 AM by Adrian Brock

    ClassCastException when an external client program looksup a

    sridhar r Newbie


      This seemingly simple issue has wasted a lot of my time. In a hope to find a solution and save my job, i am putting this issue in the forums here to see if i can find a solution. Any help will be highly appreciated.

      I am using JBoss 4.0.1sp1 and have defined JMS connection factories and queues. Everything is fine in the AppServer and all MDB's are deployed and work fine, however the problem is in an external program which should connect to the appserver and put a message in the JMS queue.

      I get a classcast exception while trying to do a lookup for the QueueConnectionFactory. The class being returned by JBoss is org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl as opposed to javax.jms.QueueConnectionFactory which is what i expect to get. The same program works on weblogic and oracle10g appservers.

      The connectionfactory is defined as below in the jms-ds.xml file in jboss..

      <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.QueueConnectionFactory</config-property>
      <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>

      The client program does a simple lookup for the connection factory and the relevent section is as shown below..

      queueConnectionFactory = (javax.jms.QueueConnectionFactory)jndiContext.lookup("jms/FAPQueueSendConnectionFactory");

      The above line fails with a ClassCastException because JBoss is not returning the connection factory typecasted to javax.jms.QueueConnectionFactory.

      The ConnectionFactory is bound and MDB's deployed are working properly with the same code as above, except for external client programs.

      Please help if you know about this issue, or have faced a similar problem before.

      - Sridhar