7 Replies Latest reply on May 4, 2007 6:37 AM by adrian.brock

    java.lang.ClassCastException

    vermanaveen

      Please help.
      I am using jboss-4.0.5.GA and have defined JMS connection factories and queues. Everything is fine in the AppServer and all MDB's are deployed and work fine. I get a ClassCastException while trying to do a lookup for the QueueConnectionFactory. The class being returned by JBoss is org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl inline to javax.jms.QueueConnectionFactory which is what i expect to get.

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

      --------------------------------------------------------------------------------
      
      <tx-connection-factory>
      <jndi-name>jms/novaJMSConnectionFactory</jndi-name>
      <xa-transaction/>
      <use-java-context>false</use-java-context>
      <track-connection-by-tx/>
      <rar-name>jms-ra.rar</rar-name>
      <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
      <security-domain-and-application>JmsXARealm</security-domain-and-application>
       </tx-connection-factory>
      
      --------------------------------------------------------------------------------
      


      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/novaJMSConnectionFactory");

      The above line fails with a ClassCastException because JBoss is not returning the connection factory typecasted to javax.jms.QueueConnectionFactory; but is returning an object to javax.naming.Reference.

      Below is my ejb-jar.xml that I use for creating the EAR file.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
      
      <!-- EJB jar xml used on Onshore Development Enviroment-->
      
      <!--
       ** This file was automatically generated by EJBGen 2.16
       ** Build: 20041105-1607
      -->
      <ejb-jar>
       <enterprise-beans>
       <message-driven>
       <ejb-name>MQManager</ejb-name>
       <ejb-class>com.ebw.ejb.mdb.MQManager</ejb-class>
       <transaction-type>Container</transaction-type>
       <message-selector>
       <![CDATA[
       Message_Redirector IS NULL AND Message_Type <> 'Data'
       ]]>
       </message-selector>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       </message-driven-destination>
      
       <resource-ref>
       <res-ref-name>jms/novaJMSConnectionFactory</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      
       <!--
       <resource-env-ref>
       <resource-env-ref-name>jms/novaJMSConnectionFactory</resource-env-ref-name>
       <resource-env-ref-type>javax.jms.QueueConnectionFactory</resource-env-ref-type>
       </resource-env-ref>
       -->
      
       <security-identity>
       <run-as>
       <role-name>admin</role-name>
       </run-as>
       </security-identity>
       </message-driven>
       </enterprise-beans>
       <assembly-descriptor>
       <security-role>
       <description>Administrator</description>
       <role-name>admin</role-name>
       </security-role>
       <container-transaction>
       <method>
       <ejb-name>MQManager</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>NotSupported</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
       <ejb-client-jar>novaEJBClient.jar</ejb-client-jar>
      </ejb-jar>
      
      


      Please also find my JBoss.xml file below.

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
       "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
      <!-- jboss xml used on for JBoss deployement-->
      
      <jboss>
       <enterprise-bean>
       <message-driven>
       <ejb-name>MQManager</ejb-name>
       <!--
       @Naveen: commented for the time being
       <pool>
       <instance-pool>15</instance-pool>
       </pool>
       -->
       <destination-jndi-name>jms/novaRequestQueue</destination-jndi-name>
       <resource-ref>
       <res-ref-name>jms/novaJMSConnectionFactory</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <jndi-name>QueueConnectionFactory</jndi-name>
       </resource-ref>
       <!-- <resource-env-ref>
       <resource-env-ref-name>jms/novaJMSConnectionFactory</resource-env-ref-name>
       <jndi-name>QueueConnectionFactory</jndi-name>
       </resource-env-ref> -->
      
       </message-driven>
       </enterprise-bean>
      
       <security-role-assignment>
       <role-name>admin</role-name>
       <principal-name>server</principal-name>
       </security-role-assignment>
      </jboss>
      


      Lastly, my build.xml is as follow.

      <?xml version="1.0" ?>
      <project name="nova" default="buildEar">
       <property file="serverbuild.properties" />
       <echo>
       Starting to Build Server. Make sure to change MQ.properties and Persistance.properties
       </echo>
      
       <target name="setupDir">
       <mkdir dir="${dest}" />
       <mkdir dir="${build}" />
       <mkdir dir="${lib}" />
       <mkdir dir="${metainf}" />
       </target>
      
       <target name="clean">
       <mkdir dir="${dest}" />
       <delete includeemptydirs="true">
       <fileset dir="${dest}" includes="**/*" />
       </delete>
       <mkdir dir="${build}" />
       <mkdir dir="${lib}" />
       <mkdir dir="${metainf}" />
       </target>
      
       <path id="project.class.path">
       <pathelement location="${code}/lib/cglib-2.1.3.jar" />
       <pathelement location="${code}/lib/colt.jar" />
       <pathelement location="${code}/lib/commons-collections-2.1.1.jar" />
       <pathelement location="${code}/lib/commons-logging-1.0.4.jar" />
       <pathelement location="${code}/lib/concurrent-1.3.2.jar" />
       <pathelement location="${code}/lib/dom4j-1.6.1.jar" />
       <pathelement location="${code}/lib/ehcache-1.1.jar" />
       <pathelement location="${code}/lib/hibernate3.jar" />
       <pathelement location="${code}/lib/jboss-cache.jar" />
       <pathelement location="${code}/lib/jboss-system.jar" />
       <pathelement location="${code}/lib/jboss-jmx.jar" />
       <pathelement location="${code}/lib/jboss-common.jar" />
       <pathelement location="${code}/lib/jboss-minimal.jar" />
       <pathelement location="${code}/lib/jboss-j2ee.jar" />
       <pathelement location="${code}/lib/jgroups-2.2.7.jar" />
       <pathelement location="${code}/lib/log4j-1.2.11.jar" />
       <pathelement location="${code}/lib/odmg-3.0.jar" />
       <pathelement location="${code}/lib/oro.jar" />
       <pathelement location="${code}/lib/protomatter.jar" />
       <pathelement location="${code}/lib/xerces-2.6.2.jar" />
       <pathelement location="${code}/lib/xml-apis.jar" />
       <pathelement location="${code}/lib/djep-full-latest.jar" />
       <pathelement location="${code}/lib/commons-beanutils-bean-collections.jar" />
       <pathelement location="${code}/lib/commons-beanutils-core.jar" />
       <pathelement location="${code}/lib/commons-beanutils.jar" />
       <pathelement location="${code}/lib/JoSQL-1.3.jar" />
       <pathelement location="${code}/lib/gentlyWEB-utils-1.1.jar" />
       <pathelement location="${code}/lib/asm.jar" />
       <pathelement location="${code}/lib/asm-attrs.jar" />
       <pathelement location="${code}/lib/jcommon-0.9.6.jar" />
       <pathelement location="${code}/lib/trove.jar" />
       <pathelement location="${code}/lib/jh.jar" />
       <pathelement location="${code}/lib/jfreechart-0.9.21.jar" />
       <pathelement location="${code}/lib/jintegra.jar" />
       <pathelement location="${code}/lib/junit-3.8.1.jar" />
       <pathelement location="${code}/lib/jdom.jar" />
       <pathelement location="${code}/lib/javax.servlet.jar" />
       <pathelement location="${code}/lib/javax.servlet.jsp.jar" />
       <pathelement location="${code}/lib/jax-qname.jar" />
       <pathelement location="${code}/lib/bcel.jar" />
       <pathelement location="${code}/lib/jnp-client.jar" />
      <!-- <pathelement location="${code}/lib/jbossall-client.jar" />-->
       <pathelement location="${code}/lib/jbossmq-client.jar" />
       <pathelement location="${code}/lib/jboss-system-client.jar" />
      
      
       <pathelement location="${code}/lib/javax.jms.jar" />
       <pathelement location="${code}/lib/excel2000.jar" />
      
       <!-- Jars for report scheduler utility -->
       <pathelement location="${code}/lib/axis.jar" />
       <pathelement location="${code}/lib/commons-discovery.jar" />
       <pathelement location="${code}/lib/idapi.jar" />
       <pathelement location="${code}/lib/webservices.jar" />
       </path>
      
       <target name="compile">
       <javac destdir="${build}" fork="true" debug="on" deprecation="on" memoryInitialSize="512m" memoryMaximumSize="1024m">
       <src path="${code}/src" />
       <include name="**/*.java" />
       <exclude name="com/novarum/nova/util/JIntegraServer.java" />
       <exclude name="com/ebw/nova/client/**" />
       <exclude name="com/ssmb/**" />
       <exclude name="com/ebw/nova/common/Batch*.*" />
       <classpath refid="project.class.path" />
       </javac>
       <mkdir dir="${code}/web/AccessControl/WEB-INF/classes" />
       <javac destdir="${code}/web/AccessControl/WEB-INF/classes" debug="on" deprecation="on">
       <src path="${code}/web/AccessControl/WEB-INF/src" />
       <include name="**/*.java" />
       <classpath refid="project.class.path" />
       <classpath>
       <pathelement location="${code}/web/AccessControl/WEB-INF/lib/struts.jar" />
       <pathelement location="${build}" />
       </classpath>
       </javac>
      
       </target>
      
       <target name="NovaJar">
       <jar destfile="${lib}/nova.jar" basedir="${build}">
       <include name="com/**" />
       <exclude name="**/JIntegraServer.class" />
       <exclude name="com/ebw/ejb/**" />
       <exclude name="com/novarum/nova/application/client/**" />
       <exclude name="com/novarum/nova/application/Help/**" />
       <exclude name="com/novarum/nova/application/local/**" />
       </jar>
       <jar destfile="${lib}/nova.jar" basedir="${code}/res" update="true" >
       <exclude name="images/**" />
       <exclude name="meta-inf/help/**" />
       <exclude name="reportTrigger/**" />
       <exclude name="properties/**" />
       </jar>
       </target>
      
       <target name="BeanJar">
       <ejbjar srcdir="${build}" descriptordir="${code}/build/descriptors/MQManager" basejarname="novaejb" flatdestdir="true">
       <dtd publicid="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" location="file:///${code}/build/dtds/ejb-jar_2_0.dtd" />
       <dtd publicid="-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" location="file:///${code}/build/dtds/application_1_3.dtd" />
       <dtd publicId="-//JBoss//DTD JBOSS 4.0//EN" location="../dtd/jboss_4_0.dtd"/>
       <dtd publicid="-//JBoss//DTD JBOSS 4.0//EN" location="file:///${code}/build/dtds/jboss-app_4_0.dtd" />
       <jboss destdir="${dest}"/>
       </ejbjar>
       </target>
      
       <target name="NovaSar">
       <jar destfile="${dest}/myapp.sar" basedir="${lib}" >
       <include name="nova.jar"/>
       <!--include name="com/ebw/nova/util/ApplicationStartupMBean.class"/-->
       </jar>
       <jar destfile="${dest}/myapp.sar" basedir="${code}/src" update="true" >
       <include name="META-INF/jboss-service.xml" />
       <exclude name="com/**" />
       </jar>
       </target>
      
       <target name="AccessControlWar">
       <war destfile="${dest}/acl.war" webxml="${code}/web/AccessControl/WEB-INF/web.xml">
       <fileset dir="${code}/web/AccessControl" excludes="${code}/web/AccessControl/WEB-INF/src, **/web.xml, **/MANIFEST.MF" />
       </war>
      
       <!-- Deleting .class files after creating war. -->
       <delete includeemptydirs="true">
       <fileset dir="${code}/web/AccessControl/WEB-INF/classes" includes="**/*" />
       </delete>
       </target>
      
       <target name="LibCopy">
       <copy file="${code}/lib/cglib-2.1.3.jar" todir="${lib}" />
       <copy file="${code}/lib/colt.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-collections-2.1.1.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-logging-1.0.4.jar" todir="${lib}" />
       <copy file="${code}/lib/concurrent-1.3.2.jar" todir="${lib}" />
       <copy file="${code}/lib/ehcache-1.1.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-cache.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-system.jar" todir="${lib}" />
       <copy file="${code}/lib/jgroups-2.2.7.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-jmx.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-common.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-minimal.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-j2ee.jar" todir="${lib}" />
       <copy file="${code}/lib/jax-qname.jar" todir="${lib}" />
       <copy file="${code}/lib/hibernate3.jar" todir="${lib}" />
       <copy file="${code}/lib/odmg-3.0.jar" todir="${lib}" />
       <copy file="${code}/lib/oro.jar" todir="${lib}" />
       <copy file="${code}/lib/protomatter.jar" todir="${lib}" />
       <copy file="${code}/lib/jdom.jar" todir="${lib}" />
       <copy file="${code}/lib/dom4j-1.6.1.jar" todir="${lib}" />
       <copy file="${code}/lib/log4j-1.2.11.jar" todir="${lib}" />
       <copy file="${code}/lib/xerces-2.6.2.jar" todir="${lib}" />
       <copy file="${code}/lib/xml-apis.jar" todir="${lib}" />
       <copy file="${code}/lib/vendor.jar" todir="${lib}" />
       <copy file="${code}/lib/asm.jar" todir="${lib}" />
       <copy file="${code}/lib/asm-attrs.jar" todir="${lib}" />
       <copy file="${code}/lib/djep-full-latest.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-beanutils-bean-collections.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-beanutils-core.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-beanutils.jar" todir="${lib}" />
       <copy file="${code}/lib/JoSQL-1.3.jar" todir="${lib}" />
       <copy file="${code}/lib/trove.jar" todir="${lib}" />
       <copy file="${code}/lib/javax.jms.jar" todir="${lib}" />
       <copy file="${code}/lib/bcel.jar" todir="${lib}" />
       <copy file="${code}/lib/jnp-client.jar" todir="${lib}" />
      <!-- <copy file="${code}/lib/jbossall-client.jar" todir="${lib}" />-->
       <copy file="${code}/lib/jbossmq-client.jar" todir="${lib}" />
       <copy file="${code}/lib/jboss-system-client.jar" todir="${lib}" />
      
       <copy file="${code}/lib/gentlyWEB-utils-1.1.jar" todir="${lib}" />
       <copy file="${code}/build/descriptors/application.xml" todir="${metainf}" />
       <copy file="${code}/build/descriptors/jboss-app.xml" todir="${metainf}" />
      
      
      
       <!-- Jars for report scheduler utility -->
       <copy file="${code}/lib/axis.jar" todir="${lib}" />
       <copy file="${code}/lib/commons-discovery.jar" todir="${lib}" />
       <copy file="${code}/lib/idapi.jar" todir="${lib}" />
       </target>
      
       <target name="buildEarClean" depends="clean,compile,NovaJar,BeanJar,NovaSar,AccessControlWar,LibCopy">
       <delete includeemptydirs="true">
       <fileset dir="${build}" includes="**/*" />
       </delete>
       <jar destfile="${dest}/nova.ear" basedir="${dest}">
       <exclude name="bin/**" />
       </jar>
       <delete includeemptydirs="true">
       <fileset dir="${dest}" includes="**/*" excludes="nova.ear" />
       </delete>
       </target>
      
       <target name="buildEar" depends="setupDir,compile,NovaJar,BeanJar,NovaSar,AccessControlWar,LibCopy">
       <jar destfile="${dest}/nova.ear" basedir="${dest}">
       <exclude name="bin/**" />
       <exclude name="nova.ear" />
       </jar>
       <delete includeemptydirs="true">
       <fileset dir="${dest}" includes="**/*">
       <exclude name="bin/**" />
       <exclude name="nova.ear" />
       </fileset>
       </delete>
       </target>
      
       <!-- Target to build report scheduler -->
       <property name="rptFolderName" value="reportTrigger" />
       <property name="rptTrgBase" location="${build}/${rptFolderName}" />
       <target name="buildReportTrigger" depends="setupDir">
       <delete includeemptydirs="true" failonerror="false">
       <fileset dir="${rptTrgBase}" includes="**/*"></fileset>
       </delete>
       <delete includeemptydirs="true">
       <fileset dir="${dest}" includes="reportTrigger.zip"/>
       </delete>
       <mkdir dir="${rptTrgBase}/lib" />
       <mkdir dir="${rptTrgBase}/com/ebw/nova/common" />
       <mkdir dir="${rptTrgBase}/com/novarum/nova/bean" />
       <copy file="${code}/res/reportTrigger/LogMgr.txt"
       tofile="${rptTrgBase}/com/novarum/nova/bean/LogMgr.java" />
       <copy file="${code}/res/reportTrigger/ReportTrigger_MQ.properties"
       tofile="${rptTrgBase}/MQ.properties" />
       <copy todir="${rptTrgBase}/com/ebw/nova/common">
       <fileset dir="${code}/src/com/ebw/nova/common"
       includes="MessagingHelper.java, NovaExtConstant.java, TriggerMessage.java" />
       </copy>
       <copy todir="${rptTrgBase}">
       <fileset dir="${code}/res/reportTrigger" includes="**/*"
       excludes="LogMgr.txt, ReportTrigger_MQ.properties" />
       </copy>
       <javac destdir="${rptTrgBase}"
       classpath="${code}/lib/jbossmq-client.jar:${code}/lib/protomatter.jar">
       <src path="${rptTrgBase}" />
       <include name="**/*.java" />
       </javac>
      
       <delete includeemptydirs="true" failonerror="false">
       <fileset dir="${rptTrgBase}" includes="**/*.java" />
       </delete>
       <!--
       <jar destfile="${rptTrgBase}/reportTrigger.jar"
       basedir="${rptTrgBase}">
       <manifest>
       <attribute name="Class-Path" value="wljmsclient.jar" />
       <attribute name="Main-Class"
       value="com.ebw.nova.common.TriggerMessage" />
       </manifest>
       </jar>
       -->
       <copy todir="${rptTrgBase}/lib">
       <fileset dir="${code}/lib/" includes="jbossmq-client.jar, jboss-j2ee.jar"/>
       </copy>
      
       <zip destfile="${dest}/reportTrigger.zip" basedir="${rptTrgBase}/.." includes="${rptFolderName}/**/*" />
      
       <delete includeemptydirs="true" failonerror="false">
       <fileset dir="${rptTrgBase}" includes="**/*" />
       <fileset dir="${rptTrgBase}/.." includes="${rptFolderName}" />
       </delete>
       </target>
      
      </project>



      Please help. I am struggling to fix it.

        • 1. Re: java.lang.ClassCastException
          weston.price

          Are you attempting to use the CF outside of JBoss?

          • 2. Re: java.lang.ClassCastException
            vermanaveen

            No

            • 3. Re: java.lang.ClassCastException
              vermanaveen

              Yes

              • 4. Re: java.lang.ClassCastException
                vermanaveen

                Sorry for the confusion..yes we are using CF outside AppServer

                • 5. Re: java.lang.ClassCastException
                  weston.price

                  The JMS/JCA adapter is not meant to be used outside of the application server. It is specifically for EJB and Servlets that need JMS XA. For JMS outside of the server you need to use something like the following:

                  
                  QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
                  


                  The "ConnectionFactory" binding is the generic ConnectionFactory meant to be used outside of the container. Also, you should remove the

                  <use-java-context>false</use-java-context>
                  


                  From you *-ds.xml file.

                  • 6. Re: java.lang.ClassCastException
                    vermanaveen

                    Based on the suggestions, I did all suggested changed. Now I am getting javax.naming.NameNotFoundException: jms not bound

                    Infact, can you please suggest how do I create my own connection factory? I have my MDB

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
                    
                    <ejb-jar>
                     <enterprise-beans>
                     <message-driven>
                     <ejb-name>MQManager</ejb-name>
                     <ejb-class>com.ebw.ejb.mdb.MQManager</ejb-class>
                     <transaction-type>Container</transaction-type>
                     <message-selector>
                     <![CDATA[
                     Message_Redirector IS NULL AND Message_Type <> 'Data'
                     ]]>
                     </message-selector>
                     <message-driven-destination>
                     <destination-type>javax.jms.Queue</destination-type>
                     </message-driven-destination>
                     <resource-ref> <res-ref-name>jms/novaJMSConnectionFactory</res-ref-name>
                     <res-type>javax.jms.QueueConnectionFactory</res-type>
                     <res-auth>Container</res-auth>
                     </resource-ref>
                    
                     <security-identity>
                     <run-as>
                     <role-name>admin</role-name>
                     </run-as>
                     </security-identity>
                     </message-driven>
                     </enterprise-beans>
                     <assembly-descriptor>
                     <security-role>
                     <description>Administrator</description>
                     <role-name>admin</role-name>
                     </security-role>
                     <container-transaction>
                     <method>
                     <ejb-name>MQManager</ejb-name>
                     <method-name>*</method-name>
                     </method>
                     <trans-attribute>NotSupported</trans-attribute>
                     </container-transaction>
                     </assembly-descriptor>
                     <ejb-client-jar>novaEJBClient.jar</ejb-client-jar>
                    </ejb-jar>
                    




                    Also find my jboss.xml

                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
                     "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
                    <!-- jboss xml used on for JBoss deployement-->
                    
                    <jboss>
                     <enterprise-bean>
                     <message-driven>
                     <ejb-name>MQManager</ejb-name>
                     <!--
                     @Naveen: commented for the time being
                     <pool>
                     <instance-pool>15</instance-pool>
                     </pool>
                     -->
                     <destination-jndi-name>jms/novaRequestQueue</destination-jndi-name>
                     <resource-ref>
                     <res-ref-name>jms/novaJMSConnectionFactory</res-ref-name>
                     <res-type>javax.jms.QueueConnectionFactory</res-type>
                     <jndi-name>QueueConnectionFactory</jndi-name>
                     </resource-ref>
                    
                     </message-driven>
                     </enterprise-bean>
                    
                     <security-role-assignment>
                     <role-name>admin</role-name>
                     <principal-name>server</principal-name>
                     </security-role-assignment>
                    </jboss>
                    


                    My client code reads MQ.properties which are defined as below.
                    
                    # Intial factory
                    java.naming.factory.initial org.jnp.interfaces.NamingContextFactory
                    
                    # Provider URL
                    #java.naming.provider.url t3://192.168.2.227:7001
                    java.naming.provider.url jnp://localhost:1099
                    
                    #java.naming.provider.url t3://novps1.nj.ssmb.com:7001
                    
                    
                    # Queue Connection Factory
                    queue.connection.factory jms/novaJMSConnectionFactory
                    #Based on suggestion; http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107646
                    #queue.connection.factory ConnectionFactory
                    
                    
                    # Request Queue
                    request.queue.context.name jms/novaRequestQueue
                    #request.queue.context.name queue/B
                    
                    
                    # Response Queue
                    response.queue.context.name jms/novaResponseQueue
                    #response.queue.context.name queue/novaResponseQueue
                    
                    #Strategy to pick one server out of the available list of servers. ['sequential', 'random'] 'sequential' is default.
                    server.selection.strategy sequential
                    
                    #Security principal
                    java.naming.security.principal client
                    
                    # Security credentials (password)
                    java.naming.security.credentials client123
                    
                    # Maximum chars allowed in a single message
                    max.chars.in.message 1500000
                    
                    # Time in milliseconds, The listener must wait for the response.
                    response.wait.time 300000
                    
                    # Time in milliseconds, for which the queue connection is maintain(should be more than 'response.wait.time').
                    queue.connection.lease.time 600000
                    
                    # Time in minutes, The time after witch session will expire [default value is 24hrs].
                    session.expire.time 1440
                    
                    # ON/OFF debug information on the system output stream. ['on', 'off']
                    mq.debug.state off
                    
                    # Set the debug leval [0, 1, 2 or 3] use largest value for maximum debug information, zero to turn off.
                    debug.level 3
                    
                    # Property file to store transaction information.
                    transaction.file Transaction.properties
                    
                    # ON/OFF lazy loading of Entity beans. ['on', 'off']
                    lazy.mode off
                    
                    # ON/OFF workflow rules. ['on', 'off']
                    workflow off
                    
                    # Whether connection to excel is to be done.['on', 'off']
                    excel.integration on
                    



                    I am getting frustrating. Please help.


                    • 7. Re: java.lang.ClassCastException

                      I don't know about frustrated, but you're getting very confused. :-)

                      And it is very difficult to help when you post "random"/incomplete information.
                      Normally, I'd ignore this post as unanswerable, instead I'm going to *guess*
                      what you problem is.

                      Posting wrong/irrelevant information is almost certainly a sign that you don't know
                      what you doing and that you should revert to the examples in the documentation
                      for comparison.

                      1) Always show full stacktraces (I've got no idea where your NameNotFound occurs)

                      2) Why do you show mdb config and then talk about client code?

                      3) The JBossMQ connnection factories are bound at "ConnectionFactory"
                      by default. If you want to alias this then look at deploy/jms/uil2-service.xml
                      which contains some different types of jndi aliases.

                      Anyway, your original problem is resolved. This is really a JNDI question not a
                      JMS question (like 50% of the questions in the forum it is offtopic).

                      If you don't understand how to configure/use JNDI then you've got no chance.
                      FAQ (sigh!)
                      http://wiki.jboss.org/wiki/Wiki.jsp?page=UsefulRoutines