9 Replies Latest reply on Feb 4, 2009 7:06 AM by Ales Justin

    How to convert -service.xml into -jboss-beans.xml ?

    Juergen Zimmermann Master

      I have the following "classic" MBean definition in messaging-service.xml:

      <server>
       <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=marketing"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">
       jboss.messaging:service=ServerPeer
       </depends>
       <depends>jboss.messaging:service=PostOffice</depends>
       </mbean>
      </server>


      How do I convert it into e.g. messaging-jboss-beans.xml ?

        • 1. Re: How to convert -service.xml into -jboss-beans.xml ?
          Ales Justin Master

           

          "Juergen.Zimmermann" wrote:

          How do I convert it into e.g. messaging-jboss-beans.xml ?

          - http://www.jboss.org/community/docs/DOC-9449

          • 2. Re: How to convert -service.xml into -jboss-beans.xml ?
            Juergen Zimmermann Master

            Can you give me a hint to convert these 2 fragement which are not covered at http://www.jboss.org/community/docs/DOC-9449:

            xmbean-dd="xmdesc/Queue-xmbean.xml">
            and
            <depends>jboss.messaging:service=PostOffice</depends>
            


            • 3. Re: How to convert -service.xml into -jboss-beans.xml ?
              Ales Justin Master

              Drop the first, copy the second, update the wiki.

              • 4. Re: How to convert -service.xml into -jboss-beans.xml ?
                Juergen Zimmermann Master

                Now I created messaging-jboss-beans.xml:

                <?xml version="1.0"?>
                <deployment xmlns="urn:jboss:bean-deployer:2.0">
                 <bean class="org.jboss.jms.server.destination.QueueService" name="Queue,name=marketing">
                 <property name="serverPeer">
                 <inject bean="jboss.messaging:service=ServerPeer"/>
                 </property>
                 <depends>jboss.messaging:service=PostOffice</depends>
                 </bean>
                
                 <bean class="org.jboss.jms.server.destination.TopicService" name="Topic,name=kunden">
                 <property name="serverPeer">
                 <inject bean="jboss.messaging:service=ServerPeer"/>
                 </property>
                 <depends>jboss.messaging:service=PostOffice</depends>
                 </bean>
                </deployment>


                However, I get the following stacktrace. Any hint is appreciated!
                2009-01-30 11:10:47,552 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Configured: name=Queue,name=marketing state=Instantiated
                java.lang.RuntimeException: Error configuring property: serverPeer for Queue,name=marketing
                 at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
                 at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
                 at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
                 at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
                 at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
                 at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                 at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                 at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                 at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
                 at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                 at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                 at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                 at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                 at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                 at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                 at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                 at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                 at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                 at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
                 at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
                 at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
                 at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
                 at org.jboss.Main.boot(Main.java:209)
                 at org.jboss.Main$1.run(Main.java:547)
                 at java.lang.Thread.run(Thread.java:619)
                Caused by: java.lang.IllegalArgumentException: Wrong arguments. setServerPeer for target org.jboss.jms.server.destination.QueueService@1ebf0d3 expected=[javax.management.ObjectName] actual=[org.jboss.jms.server.ServerPeer]
                 at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
                 at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:69)
                 at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
                 at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143)
                 at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177)
                 at org.jboss.beans.info.plugins.AbstractBeanInfo.setProperty(AbstractBeanInfo.java:289)
                 at org.jboss.kernel.plugins.dependency.PropertyDispatchWrapper.execute(PropertyDispatchWrapper.java:113)
                 at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
                 at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
                 at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:107)
                 ... 39 more


                • 5. Re: How to convert -service.xml into -jboss-beans.xml ?
                  Ales Justin Master

                  The services itself are not pojo ready:

                  Caused by: java.lang.IllegalArgumentException: Wrong arguments. setServerPeer for target org.jboss.j
                  ms.server.destination.QueueService@1ebf0d3 expected=[javax.management.ObjectName] actual=[org.jboss.
                  jms.server.ServerPeer]
                  


                  They still expect injectee ObjectName
                  instead of the real injectee.

                  Perhaps this can help:
                  <bean class="org.jboss.jms.server.destination.TopicService" name="Topic,name=kunden">
                   <property name="serverPeer">
                   <inject bean="jboss.messaging:service=ServerPeer" fromContext="name"/>
                   </property>
                   <depends>jboss.messaging:service=PostOffice</depends>
                   </bean>
                  

                  See 'fromContext' attribute.

                  But I would pojo-ize the services.


                  • 6. Re: How to convert -service.xml into -jboss-beans.xml ?
                    Juergen Zimmermann Master

                    The services are coming from JBossMessaging ;-)

                    Adding the 'fromContext' attribute yields a new stacktrace:

                    2009-02-01 09:18:25,918 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Configured: name=Queue,name=marketing state=Instantiated
                    java.lang.RuntimeException: Error configuring property: serverPeer for Queue,name=marketing
                     at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:112)
                     at org.jboss.kernel.plugins.dependency.ConfigureAction.setAttributes(ConfigureAction.java:85)
                     at org.jboss.kernel.plugins.dependency.ConfigureAction.installActionInternal(ConfigureAction.java:44)
                     at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
                     at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
                     at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                     at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                     at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                     at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
                     at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
                     at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                     at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                     at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
                     at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                     at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
                     at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
                     at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
                     at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                     at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
                     at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
                     at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
                     at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
                     at org.jboss.Main.boot(Main.java:209)
                     at org.jboss.Main$1.run(Main.java:547)
                     at java.lang.Thread.run(Thread.java:619)
                    Caused by: java.lang.IllegalArgumentException: Wrong arguments. setServerPeer for target org.jboss.jms.server.destination.QueueService@17e4fa7 expected=[javax.management.ObjectName] actual=[java.lang.String]
                     at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
                     at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:69)
                     at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
                     at org.jboss.beans.info.plugins.DefaultPropertyInfo.set(DefaultPropertyInfo.java:143)
                     at org.jboss.beans.info.plugins.BeanInfoUtil.set(BeanInfoUtil.java:177)
                     at org.jboss.beans.info.plugins.AbstractBeanInfo.setProperty(AbstractBeanInfo.java:289)
                     at org.jboss.kernel.plugins.dependency.PropertyDispatchWrapper.execute(PropertyDispatchWrapper.java:113)
                     at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
                     at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
                     at org.jboss.kernel.plugins.dependency.ConfigureAction.dispatchSetProperty(ConfigureAction.java:107)
                     ... 39 more


                    • 7. Re: How to convert -service.xml into -jboss-beans.xml ?
                      Ales Justin Master

                      Ah, it looks like we transform the ObjectName to its canonical value somewhere.

                      I guess you will need an intermediate bean,
                      that will transform the name back to ObjectName.

                      e.g.

                      <bean name="String2ObjectName" class="org.acme.transformers.String2ObjectName"/>
                      
                      <property name="serverPeer">
                      <value-factory bean="String2ObjectName" method="transform">
                       <parameter>
                       <inject bean="jboss.messaging:service=ServerPeer" fromContext="name"/>
                       </parameter>
                      </value-factory>
                      </property>
                      

                      Where String2ObjectName looks like this:
                      public ObjectName transform(String s)
                      {
                       return new ObjectName(s);
                      }
                      


                      Or try to re-use our ObjectName property editor.

                      • 8. Re: How to convert -service.xml into -jboss-beans.xml ?
                        Juergen Zimmermann Master

                        Now I get a NPE inside JBossMessaging. Therefore, I decided to post to the according user forum http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149712

                        However, there is no reaction. Should I open a JIRA ticket?

                        • 9. Re: How to convert -service.xml into -jboss-beans.xml ?
                          Ales Justin Master

                           

                          "Juergen.Zimmermann" wrote:
                          Now I get a NPE inside JBossMessaging. Therefore, I decided to post to the according user forum http://www.jboss.com/index.html?module=bb&op=viewtopic&t=149712

                          My guess (w/ looking at the service's code) would be
                          that the class implments some JMX registry hook.
                          Which probably sets MBeanServer instance.

                          And since this is now plain bean those hooks are not called,
                          but the service still expects MBeanServer to be set.

                          Note: this might be total shot in the dark. :-)

                          "Juergen.Zimmermann" wrote:

                          However, there is no reaction. Should I open a JIRA ticket?

                          No, dig in more.
                          Only once they confirm it as a bug, should you open a JIRA.