5 Replies Latest reply on Feb 1, 2005 6:34 AM by dboeckli

    error with jms mbean

    dboeckli

      hi folks,

      I am trying to access a Websphere MQ queue with JBOSS. So i carrefully followed the document:
      http://www.jboss.org/wiki/Wiki.jsp?page=SampleConfigurationForMQSeriesWebsphereMQ
      On my laptop i was able to connect to a WS-queue...so i day after i tried the same at my workplace. I did exactly the same but, always when i try to deploy the mbean i get following error in JBOSS:

      2005-01-31 16:15:49,749 DEBUG [org.jboss.deployment.SARDeployer] create operation failed for package file:/D:/JBoss/JBoss-4.0.1/server/default/deploy/wsmqmb.sar
      org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
       at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:143)
       at org.jboss.system.ServiceController.install(ServiceController.java:200)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.install(Unknown Source)
       at org.jboss.deployment.SARDeployer.create(SARDeployer.java:208)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:481)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
       at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:416)
       at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy4.start(Unknown Source)
       at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
       at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:722)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy5.deploy(Unknown Source)
       at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:413)
       at org.jboss.system.server.ServerImpl.start(ServerImpl.java:310)
       at org.jboss.Main.boot(Main.java:162)
       at org.jboss.Main$1.run(Main.java:423)
       at java.lang.Thread.run(Thread.java:534)
      Caused by: java.lang.reflect.UndeclaredThrowableException
       at org.jboss.system.ServiceCreator.install(ServiceCreator.java:204)
       at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:153)
       at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
       ... 81 more
      Caused by: java.lang.NoClassDefFoundError: com/ibm/mq/jms/MQXATopicConnectionFactory
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
       at java.lang.Class.getConstructor0(Class.java:1922)
       at java.lang.Class.getConstructor(Class.java:1019)
       at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:1211)
       at org.jboss.mx.server.MBeanServerImpl.instantiate(MBeanServerImpl.java:269)
       at org.jboss.mx.server.MBeanServerImpl.createMBean(MBeanServerImpl.java:327)
       at org.jboss.system.ServiceCreator.install(ServiceCreator.java:125)
       ... 83 more
      2005-01-31 16:15:49,764 DEBUG [org.jboss.deployment.SARDeployer] Unregistering service UCL=jmx.loading:UCL=109da93
      2005-01-31 16:15:49,764 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] UnifiedLoaderRepository removed(true) org.jboss.mx.loading.UnifiedClassLoader3@109da93{ url=file:/D:/JBoss/JBoss-4.0.1/server/default/tmp/deploy/tmp38558wsmqmb.sar ,addedOrder=14}
      2005-01-31 16:15:49,764 ERROR [org.jboss.deployment.MainDeployer] could not create deployment: file:/D:/JBoss/JBoss-4.0.1/server/default/deploy/wsmqmb.sar
      org.jboss.deployment.DeploymentException: - nested throwable: (java.lang.reflect.UndeclaredThrowableException)
      


      this are the files:

      jboss-service.xml

      <server>
      
       <mbean code="jmx.service.wsmq.WSMQConnectionFactory"
       name="jmx.service.wsmq:service=WSMQQueueConnectionFactory">
       <attribute name="JndiName">WSMQQueueConnectionFactory</attribute>
       <attribute name="JMSStyle">Queue</attribute>
       <attribute name="IsXA">false</attribute>
       <attribute name="QueueManagerName">TPF.QMGR</attribute>
       <attribute name="HostName">localhost</attribute>
       <attribute name="Channel">SYSTEM.DEF.SVRCONN</attribute>
       <!-- MQJMS_TP_BINDINGS_MQ, MQJMS_TP_CLIENT_MQ_TCPIP, MQJMS_TP_DIRECT_TCPIP -->
       <attribute name="TransportType">MQJMS_TP_CLIENT_MQ_TCPIP</attribute>
       <depends>jboss:service=Naming</depends>
       </mbean>
      
       <mbean code="jmx.service.wsmq.WSMQDestination"
       name="jmx.service.wsmq:service=WSMQRequestQueue">
       <attribute name="JndiName">wsmq/Q.IPMON</attribute>
       <attribute name="JMSStyle">Queue</attribute>
       <attribute name="QueueManagerName">TPF.QMGR</attribute>
       <attribute name="DestinationName">Q.IPMON</attribute>
       <depends>jboss:service=Naming</depends>
       </mbean>
      
      </server>
      


      ejb-jar.xml

      <?xml version="1.0"?>
      <!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>MDB</ejb-name>
       <ejb-class>jms.server.MDB</ejb-class>
       <message-selector></message-selector>
      
       <!-- Transactions are handle by the container -->
       <transaction-type>Container</transaction-type>
      
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       </message-driven-destination>
      
       <!-- The follwoing entries are specific to this sample -->
       <!-- They are used to easily configured the behaviour -->
       <!-- of the MDB -->
       <!-- The general behaviour of the MDB is to get a text -->
       <!-- message and send it back to a response queue -->
       <!-- Adding "Response to" in front of the text which -->
       <!-- which is sent back. See the MDB source code for -->
       <!-- more details. -->
       <env-entry>
       <!-- The JNDI name of the connection factory used -->
       <!-- to send the response. -->
       <env-entry-name>mdb/responseFactory</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>ConnectionFactory</env-entry-value>
       </env-entry>
       <env-entry>
       <!-- The JNDI name of the destination used to send -->
       <!-- the response. -->
       <env-entry-name>mdb/responseDestination</env-entry-name>
       <env-entry-type>java.lang.String</env-entry-type>
       <env-entry-value>queue/IPmonQueue</env-entry-value>
       </env-entry>
       <env-entry>
       <!-- If set to true, the response will be sent in a JMS -->
       <!-- transacted session. The MDB code is not doing any -->
       <!-- explicit commit on this session. Setting this value -->
       <!-- to true assumes that the MDB is configured for -->
       <!-- container managed transaction and that the -->
       <!-- responseFactory defined above is suitable for XA -->
       <!-- transaction. -->
       <!-- If set to false, the response will be sent in a non -->
       <!-- transacted session with auto-acknowledge mode. -->
       <env-entry-name>mdb/responseTransacted</env-entry-name>
       <env-entry-type>java.lang.Boolean</env-entry-type>
       <env-entry-value>false</env-entry-value>
       </env-entry>
       <env-entry>
       <!-- This setting indicates if transactions are container -->
       <!-- managed or not. It must be consistent with the -->
       <!-- transaction-type of the MDB defined above. When set -->
       <!-- to true, the MDB code will randomly generates some -->
       <!-- failures to test the transactional behaviour. -->
       <env-entry-name>mdb/containerTransaction</env-entry-name>
       <env-entry-type>java.lang.Boolean</env-entry-type>
       <env-entry-value>true</env-entry-value>
       </env-entry>
       </message-driven>
      
       </enterprise-beans>
      
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>MDB</ejb-name>
       <method-name>onMessage</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
      
      </ejb-jar>
      


      many thanks for your help

      dominique

        • 1. Re: error with jms mbean
          genman

          Caused by: java.lang.NoClassDefFoundError: com/ibm/mq/jms/MQXATopicConnectionFactory

          Check your classpath

          • 2. Re: error with jms mbean
            dboeckli

            in my opinion i had set the classpath correctly but it must be something in this direction.

            mbean was build using ant: here my build.xml file
            command was: ant mb-build

             <!-- The jar containing the classes necessary for the different JMS client samples -->
             <property name="jms.client.jar" value="jms-client.jar"/>
             <!-- The jar deployed in the EJB contained for the Message Driven Bean (MDB) -->
             <property name="jms.mdb.jar" value="wsmqmdb.jar"/>
             <!-- The jar containing the custom MBean classes for WSMQ JBoss JMS provider support -->
             <property name="jms.mb.sar" value="wsmqmb.sar"/>
            
             <!--The classpath required to compile all the code. Quite minimal since small application-->
             <path id="compile.classpath">
             <pathelement location="${jboss.dist}/client/jbossall-client.jar"/>
             <pathelement location="${jboss.server}/lib/com.ibm.mqjms.jar"/>
             <!-- For the custom MBeans -->
             <pathelement location="${jboss.server}/lib/jboss.jar"/>
             </path>
            
             <path id="client.run.classpath">
             <pathelement location="${jars}/${jms.client.jar}"/>
             <pathelement location="${jboss.server}/lib/com.ibm.mqjms.jar"/>
             <pathelement location="${jboss.server}/lib/com.ibm.mq.jar"/>
             <pathelement location="${jboss.dist}/client/jbossall-client.jar"/>
             <pathelement location="${jboss.dist}/client/log4j.jar"/>
             </path>
            
             <target name="main" description="Default target displaying a short usage">
             <echo message="You can process the different targets in the following order:"/>
             <echo message=""/>
             <echo message=" Compile/package MBs: mb-build"/>
             <echo message=" Deploy MBs: mb-deploy"/>
             <echo message=" Compile/package MDBs: mdb-build"/>
             <echo message=" Deploy MDBs: mdb-deploy"/>
             <echo message=" Run JMS client: jms-client"/>
             <echo message=" Undeploy MBs: mb-undeploy"/>
             <echo message=" Undeploy MDBs: mdb-undeploy"/>
             <echo message=" clean: clean classes and jars/wars"/>
             <echo message=" veryclean: clean target and backup files"/>
             <echo message=""/>
             </target>
            
             <target name="mb-build" description="Build and package MBs">
             <mkdir dir="${jars}"/>
             <mkdir dir="${classes}"/>
            
             <!-- Compile -->
             <javac srcdir="${src}"
             destdir="${classes}"
             includes="jmx/**"
             classpathref="compile.classpath"
             debug="true"
             deprecation="false"
             optimize="false"/>
            
             <!-- Package -->
             <mkdir dir="${classes}/META-INF"/>
             <copy file="${resources}/jboss-service.xml" todir="${classes}/META-INF"/>
             <jar jarfile="${jars}/${jms.mb.sar}">
             <fileset dir="${classes}">
             <include name="jmx/**"/>
             <include name="META-INF/jboss-service.xml"/>
             </fileset>
             </jar>
             </target>
            


            com.ibm.mq.jar, com.ibm.mqjms.jar, com.ibm.mqbind.jar are in JBOSS_HOME/server/default/lib.

            greetings

            dominique






            • 3. Re: error with jms mbean
              genman


              So, that class is in those jar files? How do you know?

              • 4. Re: error with jms mbean
                dboeckli

                hi genman,

                yes, it is there. It is in com.ibm.mqjms.jar. Verified with an Testprogram just building an instance of it.

                The same sar deployed on my laptop in jboss i get no error and everything is working fine.
                To be more exactly: this error i get when i start jboss (with the sar file in the deploy folder) or when i deploy the sar to the deploy folder).

                i use jboss 4.01 and IBM Websphere MQ 5.3 CSD09

                i just tried another thing:

                i copied/pasted the complete jboss installation folder with all its content (incl. the sar file) of my working pc to my laptop and there it is working...no error

                • 5. Re: error with jms mbean
                  dboeckli

                  ok...i found the error.
                  the com.ibm.....jar were in the java lib/ext folder. i removed them and now all is fine.

                  thanks for your help
                  and sorry for that