5 Replies Latest reply on Jan 27, 2006 4:45 AM by bdinnerv

    clarification of use

    bdinnerv

      Hi All,

      Have been scratching my head for a few hours now trying to get something to work with jboss 4.0.3, spring 1.2.6 and jboss-spring deployer and thought i would check to see if what i am doing is actually possible.

      I have a bean defined in spring that is exported as an MBean -

      <bean id="exporter"
      class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">


      <entry key="bean:name=submitterManager" value-ref="submitterManager" />




      <bean id="submitterManager" class="foo.bar.Class" lazy-init="false">


      And have packaged this up into a spring archive (foo.spring). What i am expecting to happen is that once this is deployed, the spring context will be loaded and will register an MBean in the jboss mbean server - is this a valid expectation?

      What i can see happening at the moment is that a resource is being registered with jndi - foo and there is an extra MBean being loaded for the deployer itself, but i cannot find my MBean in the jboss jmx console (or from other jmx consoles). It apears that the spring context is being loaded an registered with JNDI, but the exporter is not being executed - like everything is just sitting there idle.

      I have searched all the other posts re jmx + spring + jboss and have checked the problem with multiple mbean servers etc. I have even run up jboss with remote debugging and eclipse attached with a break point set in the default constructor for my bean that is to be loaded as a mbean and can confirm that it is not being loaded into the jvm.

      Any help appreciated.

      Regards,

      Ben

        • 1. Re: clarification of use
          bdinnerv

          PS, have tried this with a combination of jdk1.4 / 1.5 and also jboss 3.2.5 + 4.0.2 / 3 and both different deployers.

          • 2. Re: clarification of use
            alesj

            Yep, this is a problem with current version of deployer.
            You cannot get the bean from bean factory unless explicity injecting it in EJB enterprise bean.
            The reason for this is that the actual bean factory is really just a bean factory implementation and NOT an application context (which is capable of a lot more; postprocessing, listeners, singleton creation at start, ...).
            To be able to do this (your task) you need anapplication context impl of bean factory - deploys singletons at creation time.
            And this has been done in a new version of deployer (it is not yet on the sourceforge), jboss-service.xml must also be changed.

            You can temporarly download it here:
            - http://www.genera-lynx.com/temp/jboss-spring-jdk5.jar
            - http://www.genera-lynx.com/temp/jboss-service.xml

            You will probably have to change Spring libraries to version 1.2.5.

            Rgds, Ales

            • 3. Re: clarification of use
              alesj

              Aha, missed this one -- spring 1.2.6.
              That's even better. I thought you were using version from when deployer was first introduced.

              • 4. Re: clarification of use
                bdinnerv

                Hi Ales,

                Great! Thanks ,love your work!

                I had a feeeling that that may be the case, is just hard to figure out exactly what it should and shouldnt do docco at the moment and there dont seem to be to omany ppl out there using it yet (not a heap of threads found on the issuce on news groups etc)

                I will give the updated version a go and will update the this thread with the outcome so that hopefully the next person that stumbles upon this prob will know what to do.

                Looks like i can go back to using spring again, was just reading up through a hole lot of EJB3 getting started stuff and was about to take the plunge - which i should probably do but at the moment have a job to do and will get it done the way i know.

                Cheers,

                Ben

                • 5. Re: clarification of use
                  bdinnerv

                  Well, i wish all fixes could be that easy. with about 3 minutes of downlaoding files, moving them to the server and redeploying by .spring archive, everything is now working as expected. My MBean is now being instatiated at deploy time and is visible and working from the jmx console.

                  All is working fine with JBoss 4.0.3SP1 and springframework 1.2.6, along with JDK1.5

                  Thanks again Ales