6 Replies Latest reply on Sep 27, 2012 2:05 AM by thr4sh3r

    Using an Mbean with Jboss 7.1

    thr4sh3r

      Good day,

       

      I am in the process of upgrading an old project that was running on Jboss 4.x. I am using JBoss 7.1 but I have not been able to get this to work.

       

      First, let me show the existing configuration.

       

      web.xml

      <resource-ref>
      <res-ref-name>TemplateTransport</res-ref-name>
      <res-type>coza.blah.blah.blah.TransportService</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      jboss-web.xml

      <resource-ref>
      <res-ref-name>TemplateTransport</res-ref-name>
      <jndi-name>java:/TemplateTransport</jndi-name>
      </resource-ref>

      TemplateTransport-service.xml - Deployed in JBoss deploy folder

      <server>
      <mbean code="coza.blah.blah.blah.TransportService" name="jboss:id=TemplateTransport">     
       
      <attribute name="Service"></attribute>
       
      <attribute name="Network">BLAH</attribute>
       
      <attribute name="Daemon">BLAH:7500</attribute>
       
      <attribute name="CreateCmTransport">true</attribute>
       
      <attribute name="CmName">blah.blah.blah</attribute>
       
      <attribute name="LedgerFile">C:/TempWork/Blah/blah.blah</attribute>
       
      <attribute name="JndiName">java:/TemplateTransport</attribute>
      </mbean>
      </server>

      The MBean .jar file is located in the JBoss server/default/lib directory.

      The Java call is as follows:

      transport = new InitialContext().lookup("java:/TemplateTransport");

       

      JBoss 7.1


      So I have copied the resource-ref from web.xml to the new project's web.xml, and created a jboss-web.xml in the new project as well. I have deployed the TemplateTransport-service.xml to standalone/deployments. And I have copied the MBean .jar file to the standlone/lib directory, and copied it to my local repository for the Maven dependence.


      I have Tibco and Mbean dependency references in my POM.xml.

       

      I have done a lot of reading on this issue, but have not been able to resolve it.

       

      I have also changed the Java call as follows:

       

      @EJB(lookup="java:jboss/TemplateTransport")

      private TibrvCmTransport transport;

      I modified all JNDI names to be "java:jboss/TemplateTransport".

       

       

      When I try deploy my WAR file, I get the following error and deployment fails:

       

      INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015863: Replacement of deployment "support.war" by deployment "support.war" was rolled back with failure message

      {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.support.support.env.TemplateTransportjboss.naming.context.java.jboss.TemplateTransportMissing[jboss.naming.context.java.module.support.support.env.TemplateTransportjboss.naming.context.java.jboss.TemplateTransport]"]}

       

      INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

      JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.naming.context.java.jboss.TemplateTransport (missing) dependents: [service jboss.naming.context.java.module.support.support.env.TemplateTransport]

       

       

      If someone can please point me in the right direction, or let me know what I am doing wrong, it would be much appreciated. I am still relatively new to JBoss, so I may have made a silly mistake, or I am doing it completely wrong.

       

      Thanks in advance.

        • 1. Re: Using an Mbean with Jboss 7.1
          jbertram

          My guess is that your MBean isn't being deployed.  Take a look at http://middlewaremagic.com/jboss/?p=366 and create a service archive which contains the MBean definition and any necessary libraries.  You can't just drop stuff in standalone/lib and have it globally available to deployed applications.  JBoss AS7 uses a modular classloader which is quite unlike the hierarchical classloader in previous versions.

          • 2. Re: Using an Mbean with Jboss 7.1
            thr4sh3r

            Thanks for your reply.

             

            I have created a SAR file as the link describes. But when I try deploy the SAR file, I get a ClassNotFoundException for my interface class.

             

            Could this be related to JIRA AS7-887? (Support legacy ServiceMBeans in SAR deployments)

            Although I don't see any reference to org.jboss.system.ServiceMBean anywhere in my source code.

             

            Or have I missed something else or done something wrong?

            • 3. Re: Using an Mbean with Jboss 7.1
              jbertram

              List the content and structure of your SAR as well as the full stack trace for the exception you're receiving.

              • 4. Re: Using an Mbean with Jboss 7.1
                thr4sh3r

                I have removed our package names, hope that's ok.

                 

                TransportService.sar

                 

                META-INF/jboss-service.xml

                coza/blah/blah/blah/TibcoTransportService.java

                coza/blah/blah/blah/TibcoTransportServiceMBean.java

                 

                StackTrace when deploying SAR:

                 

                08:03:26,492 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "TransportService.sar"

                08:03:26,641 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."TransportService.sar

                ".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."TransportService.sar".INSTALL: Failed to process phase INSTALL of deployment "TransportService.sar"

                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]

                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]

                        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                Caused by: java.lang.IllegalArgumentException: JBAS017220: Class not found

                        at org.jboss.as.service.ReflectionUtils.getClass(ReflectionUtils.java:115)

                        at org.jboss.as.service.ReflectionUtils.getClassHierarchy(ReflectionUtils.java:122)

                        at org.jboss.as.service.ParsedServiceDeploymentProcessor.addServices(ParsedServiceDeploymentProcessor.java:108)

                        at org.jboss.as.service.ParsedServiceDeploymentProcessor.deploy(ParsedServiceDeploymentProcessor.java:99)

                        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]

                        ... 5 more

                Caused by: java.lang.ClassNotFoundException: coza.blah.blah.blah.TibcoTransportService from [Module "deployment.TransportService.sar:main" from Service Module Loader]

                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                        at java.lang.Class.forName0(Native Method) [rt.jar:1.6.0_26]

                        at java.lang.Class.forName(Class.java:247) [rt.jar:1.6.0_26]

                        at org.jboss.as.service.ReflectionUtils.getClass(ReflectionUtils.java:113)

                        ... 9 more

                 

                 

                Thanks for the help.

                • 5. Re: Using an Mbean with Jboss 7.1
                  jbertram

                  Is that list of contents accurate?  Do you really have uncompiled source files in your SAR and no compiled class files?  If so, I'd say that's your problem.

                  1 of 1 people found this helpful
                  • 6. Re: Using an Mbean with Jboss 7.1
                    thr4sh3r

                    Sorry for the slow reply.

                     

                    You are correct, that was my problem. Can't believe I made such a stupid rookie mistake.

                     

                    Thanks for all the help! Seems to all be working now.