8 Replies Latest reply on Jul 1, 2008 7:33 AM by itsme

    Can't deploy MBeans on JBoss5 Beta4

    jimmycallaghan

      We use MBeans loads in JBoss404 but I'm having trouble deploying any to JBoss5 Beta4. As a baasic test I've created the following bean:

      Interface:

      import org.jboss.annotation.ejb.Management;
      
      @Management
      public interface ServiceProviderMBean
      {
       public String viewServiceProviders();
      }


      and class:
      import org.jboss.annotation.ejb.Service;
      
      @Service(objectName = "mpee:service=ServiceProviderMBean")
      public class ServiceProviderMBeanImpl implements ServiceProviderMBean
      {
       public String viewServiceProviders()
       {
       return "hello";
       }
      }


      There are a load of other EJB3 beans in this application that all get deployed fine. However, this MBean isn't even seen by the deployer. It is simply not deployed. I've checked the documentation and my imports seem to be correct. Am I missing something obvious?

        • 1. Re: Can't deploy MBeans on JBoss5 Beta4
          jaikiran

          How do you package these services?

          By the way, JBoss-5.0 CR1 just got released. You may want to start using that instead of JBoss-5.0 Beta.

          • 2. Re: Can't deploy MBeans on JBoss5 Beta4
            jimmycallaghan

            They're packaged by an ant build script into a JAR which in turn resides in an EAR. The application.xml of that EAR has an entry for the JAR that contains the beans. The Management bean is in the same JAR as the Session beans that are being deployed ( I've checked that they are actually in the JAR by exploding it and inspecting).

            Great news about JBoss5 CR1. I will download and install immediately!

            • 3. Re: Can't deploy MBeans on JBoss5 Beta4
              jimmycallaghan

              Looks like I'm the first person to download JBoss5 CR1!

              Excellent.

              • 4. Re: Can't deploy MBeans on JBoss5 Beta4
                jaikiran

                 

                import org.jboss.annotation.ejb.Management;

                import org.jboss.annotation.ejb.Service;


                Just noticed - In JBoss-5, these imports should be:
                import org.jboss.ejb3.annotation.Management;
                
                import org.jboss.ejb3.annotation.Service;


                • 5. Re: Can't deploy MBeans on JBoss5 Beta4
                  jimmycallaghan

                  Thanks again!

                  What documentation were you looking at that gave these imports? I looked around and saw some obscure documentation giving the imports as they were in my original post. If you could give me a URL to the stuff you're looking at it would be much appeciated.

                  Also, unfortunately I ran into trouble right off the bat with JBoss5 CR1. I'm getting lots of nasty stack traces when I deploy the previously mentioned EAR files to JBoss5 CR1.

                  Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve schema nsURI= location=persistence


                  I'll dig around for the solution to that a little later though.

                  • 6. Re: Can't deploy MBeans on JBoss5 Beta4
                    jaikiran

                     

                    "jimmycallaghan" wrote:

                    Also, unfortunately I ran into trouble right off the bat with JBoss5 CR1. I'm getting lots of nasty stack traces when I deploy the previously mentioned EAR files to JBoss5 CR1.

                    Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve schema nsURI= location=persistence




                    I too got the same error when i ported my sample app from Beta4 to CR1. XML parsing has become stricter in CR1. You probably had not specified the schema declaration in the persistence.xml. You will have to change the persistence.xml to:

                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                     version="1.0">
                    
                    
                     <persistence-unit name="blah....">
                     <jta-data-source>blah...</jta-data-source>
                    
                     </persistence-unit>
                    </persistence>


                    • 7. Re: Can't deploy MBeans on JBoss5 Beta4
                      jaikiran

                       

                      "jimmycallaghan" wrote:


                      What documentation were you looking at that gave these imports? I looked around and saw some obscure documentation giving the imports as they were in my original post. If you could give me a URL to the stuff you're looking at it would be much appeciated.



                      I was using this http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/index.html for EJB3. But when i started using JBoss-5 Beta, i also ran into similar issues. I had found a post/article (i couldn't locate it now) which mentioned this change in imports for JBoss-5. These days, i just include the JBoss-5 client jars in my eclipse classpath and rely on Eclipse's auto-complete option while using these annotations.



                      • 8. Re: Can't deploy MBeans on JBoss5 Beta4
                        itsme