[jboss-user] [Clustering/JBoss] - Re: Invocation of startSingleton()
bstansberry@jboss.com
do-not-reply at jboss.com
Thu Jan 29 13:14:12 EST 2009
Hmm, simple question, complicated answer from me.
First, I'll cut to the bottom line. Instead of deploying via a -service.xml, use a -jboss-beans.xml:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="StartupTestingCFD2" class="com.xitee.cfd.be2.StartupService2">
|
| <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="test:service=StartupTestingCFD2", exposedInterface=org.jboss.ha.singleton.examples.HASingletonMBeanExampleMBean.class, registerDirectly=true)</annotation>
|
| </bean>
|
| <bean name="HASingletonController"
| class="org.jboss.ha.singleton.HASingletonController">
|
| <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="test:service=HASingletonController", exposedInterface=org.jboss.ha.singleton.HASingletonControllerMBean.class, registerDirectly=true)</annotation>
|
|
| <property name="HAPartition"><inject bean="HAPartition"/></property>
| <property name="target"><inject bean="StartupTestingCFD2"/></property>
| <property name="targetStartMethod">startSingleton</property>
| <property name="targetStopMethod">stopSingleton</property>
|
| </bean>
|
| </deployment>
|
Now, the details.
First, deploying via a -service.xml should work. But in actually deploying an example to test it before posting here I found a bug: https://jira.jboss.org/jira/browse/JBAS-6435 . Hopefully that will be fixed for 5.0.1 which is due out soon.
Now, let's assume JBAS-6435 were fixed and you could use a -service.xml. It would look like this:
| <server>
|
| <mbean code="com.xitee.cfd.be2.StartupService2"
| name="test:service=StartupTestingCFD2">
| </mbean>
|
| <mbean code="org.jboss.ha.singleton.HASingletonController"
| name="test:service=HASingletonController">
|
| <attribute name="HAPartition"><inject bean="HAPartition"/></attribute>
|
| <attribute name="TargetName">test:service=StartupTestingCFD22</attribute>
| <attribute name="TargetStartMethod">startSingleton</attribute>
| <attribute name="TargetStopMethod">stopSingleton</attribute>
| </mbean>
|
| </server>
There were two problems with your XML:
1) The values for the "name" attribute on your mbean elements were invalid. The value needs to be a legal JMX ObjectName.
2) I need to update the AS 5 docs need to be to specify how to dependency inject the HAPartition, i.e.
<attribute name="HAPartition"><inject bean="HAPartition"/></attribute>
instead of
<depends optional-attribute-name="ClusterPartition"
| proxy-type="attribute">jboss:service=${jboss.partition.name:DefaultPartition}</depends>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205655#4205655
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205655
More information about the jboss-user
mailing list