2 Replies Latest reply on Jul 13, 2007 1:36 PM by criterio

    Sar within ear - dependencies check

    criterio

      Hello,
      I have a question about xmbean lifecycle (especially about dependencies check). Is it
      different when sar is deployed directly into jboss deploy directory than when it's deployed
      within ear? What I've observed is that when sar within ear is deployed, it's allways
      successfull and that is my problem :)

      I have made simple example to explain what I mean :

      my xmbean class :

      import org.jboss.logging.Logger;
      import org.jboss.system.ServiceMBeanSupport;
      
      public class XMBeanTestService extends ServiceMBeanSupport {
       private Logger logger = Logger.getLogger(XMBeanTestService.class);
      
       private Long propertyValue;
      
       protected void createService() throws Exception {
       logger.info("createService()");
       super.createService();
       }
      
      
       protected void startService() throws Exception {
       logger.info("startService()");
       super.startService();
       }
      
      ...
       public Long getProperty() {
       logger.info("getProperty : " + propertyValue);
       return propertyValue;
       }
      
       public void setProperty(Long propertyValue) {
       logger.info("setProperty(" + propertyValue + ")");
       this.propertyValue = propertyValue;
       }
      
      }
      


      jboss-service descriptor that should cause an error "Incomplete Deployment..." :
      <?xml version='1.0' encoding='UTF-8' ?>
      <!DOCTYPE server PUBLIC
       "-//JBoss//DTD MBean Service 3.2//EN"
       "http://www.jboss.org/j2ee/dtd/jboss-service_3_2.dtd">
      <server>
       <mbean code="service.XMBeanTestService"
       name="XMBeanTest:module=configuration"
       xmbean-dd="META-INF/xmbean.xml">
       <depends>
       jboss.j2ee:ear=madeup.ear,jar=madeup.jar,name=madeup,service=EJB3
       </depends>
       </mbean>
      </server>
      


      and xmbean.xml :
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_0.dtd">
      <mbean>
       <descriptors>
       <persistence persistPolicy="OnUpdate"
       ...
       <persistence-manager
       value="org.jboss.mx.persistence.DelegatingPersistenceManager" />
       </descriptors>
       <class>service.XMBeanTestService</class>
       <attribute access='read-write' getMethod='getProperty'
       ...
       </attribute>
       <operation>
       <name>create</name>
       ...
      


      I've packaged all of this into the sar archive. After deployment server.log shows :
      01:00:26,177 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
      --- MBeans waiting for other MBeans ---
      ObjectName: XMBeanTest:module=configuration
       State: CONFIGURED
       I Depend On:
       jboss.j2ee:ear=madeup.ear,jar=madeup.jar,name=madeup,service=EJB3
      
      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.j2ee:ear=madeup.ear,jar=madeup.jar,name=madeup,service=EJB3
       State: NOTYETINSTALLED
       Depends On Me:
       XMBeanTest:module=configuration
      

      And this is ok, but when sar is placed whithin ear (ear-test.ear), things looks different :
      01:20:57,661 INFO [EARDeployer] Init J2EE application:
       file:/opt/install/jboss-4.2.0.GA/server/default/deploy/ear-test.ear
      01:20:57,803 INFO [EARDeployer] Started J2EE application:
      file:/opt/install/jboss-4.2.0.GA/server/default/deploy/ear-test.ear
      


      No error message and my XMBeanTest is visible in JMX console. I'm stuck with this. Can someone please help me? Thank you in advance.



      (Jboss 4.2.0GA)