4 Replies Latest reply on Apr 21, 2009 2:47 AM by swd847

    Using SAR(Service Archive) with Seam and JBOSS

    usison
      Dearest Seam Users,

      I am trying to deploy a SAR(Service Archive) File within an ear file into the JBOSS Container.
      My Service Class is implementing the  org.jboss.varia.scheduler.Schedulable Interface and is configured within the  jboss-service.xml as an  mbean.

      `<?xml version="1.0" encoding="UTF-8"?>
      <server>
           <!-- mbean code="org.jboss.varia.scheduler.Scheduler" name="jboss.org:service=SomeClass">
               <attribute name="StartAtStartup">true</attribute>
               <attribute name="SchedulableClass">SomeClass</attribute>
               <attribute name="SchedulableArguments">XXXX,XXXX,XXXX,XXXX,XXXX</attribute>
               <attribute name="SchedulableArgumentTypes">java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,</attribute>
               <attribute name="InitialStartDate">NOW</attribute>
               <attribute name="SchedulePeriod">60000</attribute>
               <attribute name="InitialRepetitions">-1</attribute>
           </mbean-->
      </server>`

      My EAR Structure looks like this:

      +MyApp.ear
        + lib
        + META-INF
        + jboss-seam.jar
        + myWeb.war
        + myServiceSar.sar




      Within my Service Class i want to inject a seam component with the @In Annotation which turns out to be always null!

      Does anyone know how to solve this problem or has anyone suffered the same problem ?? Is it possible at all ?


      Best regards

      S.U.


        • 1. Re: Using SAR(Service Archive) with Seam and JBOSS
          pgmjsd

          While I have not done 'SAR inside EAR', I have deployed a SAR that used EJBs inside an EAR.  It required some trickery but I did get it to work.   I don't recommend it, and I'm replacing all that with ordinary EJBs and POJOs to keep things simple.

          • 2. Re: Using SAR(Service Archive) with Seam and JBOSS
            norman

            We don't directly support MBeans as Seam components.  You might try creating an @Service EJB3 component.  (a session bean that gets registered as an MBean)  I haven't tried it, but I think it should work. 

            • 3. Re: Using SAR(Service Archive) with Seam and JBOSS
              swd847

              I have used @Service, and injection does not work. Instead I had to do the following:


                  public int getThreadCount()
                  {
                      int res = 0;
                      try
                      {
                   Lifecycle.beginCall();
                   JobWorkerManager manager = (JobWorkerManager) Component
                        .getInstance("jobWorkerManager");
                   res = manager.getThreadCount();
                      }
                      finally
                      {
                   Lifecycle.endCall();
                      }
                   return res;
                  }
              
              



              • 4. Re: Using SAR(Service Archive) with Seam and JBOSS
                swd847

                If I were to do a patch to allow for automatically registering seam components as mbeans, would it be likely to get accepted into seam?