[jboss-dev-forums] [Design of POJO Server] - ServiceControllerContext.target is null via @JMX
alesj
do-not-reply at jboss.com
Fri Aug 8 07:34:01 EDT 2008
While figuring out what's the problem with ServiceSupportMBean,
I saw that ServiceControllerContext's target is null
if mbean is registered via @JMX on plain MC pojo.
So things like this don't get what they expect:
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="XMLLoginConfig" class="org.jboss.demos.models.old.XMLLoginConfig"/>
|
| <bean name="SecurityConfig" class="org.jboss.demos.models.old.SecurityConfig">
| <property name="defaultLoginConfig"><inject bean="XMLLoginConfig"/></property>
| </bean>
|
| <bean name="SecurityChecker" class="org.jboss.demos.models.old.Checker">
| <property name="loginConfig"><inject bean="jboss.security:service=XMLLoginConfig"/></property>
| <property name="securityConfig"><inject bean="jboss.security:service=SecurityConfig"/></property>
| </bean>
|
| </deployment>
|
Where XMLLoginConfig has
| @JMX(name="jboss.security:service=XMLLoginConfig", exposedInterface=XMLLoginConfigMBean.class)
| public class XMLLoginConfig extends ServiceMBeanSupport implements XMLLoginConfigMBean
|
and SecurityConfig
| @JMX(name = "jboss.security:service=SecurityConfig", exposedInterface = SecurityConfigMBean.class)
| public class SecurityConfig extends ServiceMBeanSupport implements SecurityConfigMBean
|
And then SecurityChecker was getting nulls injected at Configure:
| public class Checker
| {
| private boolean loginConfigSet;
| private boolean securityConfigSet;
|
| public void setLoginConfig(XMLLoginConfig loginConfig)
| {
| this.loginConfigSet = true;
| }
|
| public void setSecurityConfig(SecurityConfig securityConfig)
| {
| this.securityConfigSet = true;
| }
|
| public void start()
| {
| if (loginConfigSet == false)
| throw new IllegalArgumentException("Login config set not called");
| if (securityConfigSet == false)
| throw new IllegalArgumentException("Security config set not called");
| }
| }
|
Is this expected?
Since looking at the system-jmx code,
the ServiceControllerContextActions::getLifecycleOnly
doesn't seem to have the code to actually set the existing MC pojo
target on the coresponding ServiceControllerContext.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169568#4169568
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169568
More information about the jboss-dev-forums
mailing list