3 Replies Latest reply on Mar 27, 2002 12:52 PM by Adrian Brock

    ClassNotFoundException When Deploying MBean

    James Patterson Newbie

      When I register my (JBoss independent) MBean in jboss.jcml I keep getting a ClassNotFoundException. MLet's let you specify the location of your class - how do you do it with the tag?

      I'm trying to avoid writing a JBoss Service MBean (see sgturner at http://main.jboss.org/thread.jsp?forum=47&thread=9671&message=482196&q=#482196).

      I have both the JBoss and JMX book and a fast internet connection - can someone point me in the right direction?!?

      Thanks,
      James

        • 1. Re: ClassNotFoundException When Deploying MBean
          Adrian Brock Master

          With jboss2.4.4 you can add your MBean to jboss.conf
          which uses MLets.

          If this is the wrong order, just add a ClassPathExtension
          to jboss.conf and leave your MBean in jboss.jcml

          With jboss3, jboss.conf and jboss.jcml are combined
          into jboss-service.xml. You can also create
          my-service.xml snippets or a my-service.sar to
          hot deploy MBeans.

          Regards,
          Adrian

          • 2. Re: ClassNotFoundException When Deploying MBean
            James Patterson Newbie

            Adrian, thanks for taking the time to point me in the right direction!

            This is what I have done:

            I have the following lines added to jboss.jcml:



            <!-- at the very end of the file -->



            And the following added to jboss.conf:





            Unfortunately, now I'm back to the problem where my MBean is being instantiated too early (like almost immediately):

            C:\java\JBoss-2.4.3\bin>run
            JBOSS_CLASSPATH=;run.jar;../lib/crimson.jar
            jboss.home = C:\java\JBoss-2.4.3
            Using JAAS LoginConfig: file:/C:/java/JBoss2.4.3/conf/default/auth.conf
            Using configuration "default"
            [root] Started Log4jService, config=file:/C:/java/JBoss2.4.3/conf/default/log4j.properties
            [Info] Java version: 1.4.0,Sun Microsystems Inc.
            [Info] Java VM: Java HotSpot(TM) Client VM 1.4.0-b92,Sun Microsystems Inc.
            [Info] System: Windows 2000 5.0,x86
            [Shutdown] Shutdown hook added
            [Default] JmsQueueParent intializeContext - Success
            [Default] EXCEPTION: JmsQueueParent jndiLookup() - jndi failed for ConnectionFactory
            [Default] javax.naming.ServiceUnavailableException: Connection refused: connect.Root exception is
            [Default] java.net.ConnectException: Connection refused: connect

            Any advice?!?

            Thanks,
            James

            • 3. Re: ClassNotFoundException When Deploying MBean
              Adrian Brock Master

              You've got further. :-)

              First, I wouldn't add ../../deploy to the classpath
              you will lose the ability to hot-deploy

              I think your problem now is due to the two
              phase startup of jboss's services

              Phase I creates all services
              Phase II starts all services (including linking to other
              services)

              You are looking for the Queue after the QueueMananger
              is created (phase I), but before the Queue is bound
              into jndi (phase II).

              I think this would work with JBoss3, because most
              services are now one phase.
              Even if that failed, you can specify an MBean dependency
              to force a specific order.

              There are a number of ways to get this to work.
              The easiest is to implement JBoss's service interface
              which will let you take part in the two phase processing.
              You put your code in startService();

              Regards,
              Adrian