[Design of POJO Server] - Re: ServiceControllerContext.target is null via @JMX
by alesj
This would probably do the trick.
Legit enough?
| Index: src/main/org/jboss/system/ServiceController.java
| ===================================================================
| --- src/main/org/jboss/system/ServiceController.java (revision 76752)
| +++ src/main/org/jboss/system/ServiceController.java (working copy)
| @@ -327,12 +327,12 @@
| register(serviceName, depends, true);
| }
|
| - public void register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLifecycle) throws Excep
| + public ServiceControllerContext register(ObjectName serviceName, Collection<ObjectName> depends, boolean includeLife
| {
| if (serviceName == null)
| {
| log.warn("Ignoring request to register null service: ", new Exception("STACKTRACE"));
| - return;
| + return null;
| }
|
| log.debug("Registering service " + serviceName);
| @@ -348,13 +348,14 @@
| {
| doInstall(controller, context);
| doChange(controller, context, ControllerState.CONFIGURED, "configure");
| + return context;
| }
| catch (Throwable t)
| {
| // Something went wrong
| safelyRemoveAnyRegisteredContext(context);
|
| - DeploymentException.rethrowAsDeploymentException("Error during register: " + serviceName, t);
| + throw DeploymentException.rethrowAsDeploymentException("Error during register: " + serviceName, t);
| }
| }
|
| Index: src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java
| ===================================================================
| --- src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java (revision 76752)
| +++ src/main/org/jboss/system/microcontainer/jmx/ServiceControllerRegistrationLifecycleCallback.java (working copy)
| @@ -23,7 +23,6 @@
|
| import java.util.HashMap;
| import java.util.Map;
| -
| import javax.management.MBeanServer;
| import javax.management.ObjectName;
| import javax.management.StandardMBean;
| @@ -34,6 +33,7 @@
| import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
| import org.jboss.logging.Logger;
| import org.jboss.mx.server.ServerConstants;
| +import org.jboss.system.microcontainer.ServiceControllerContext;
|
| /**
| * ServiceControllerLifecycleCallback.
| @@ -102,7 +102,9 @@
| {
| // Don't include the lifecycle callouts unless we know the MBean implementation
| // wants them and supports "double invocation"
| - getServiceController().register(objectName, null, false);
| + ServiceControllerContext scc = getServiceController().register(objectName, null, false);
| + if (scc != null)
| + scc.setTarget(context.getTarget());
| }
| catch (Exception e)
| {
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169570#4169570
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169570
17 years, 8 months
[Design of POJO Server] - ServiceControllerContext.target is null via @JMX
by alesj
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
17 years, 8 months
[Design of POJO Server] - Re: Integrating aop-mc-int bean metadata with AS5
by alesj
"adrian(a)jboss.org" wrote :
| A quick hack for you (though not the correct fix)
| would be to change your ScopeInfo initialization code to something like:
|
I've already applied something similar:
- http://fisheye.jboss.org/browse/JBossAS/projects/jboss-deployers/trunk/de...
| <> 113 - scopeInfo.setScope(unit.getScope());
| 114 - scopeInfo.setMutableScope(unit.getMutableScope());
| 117 + if (scopeInfo != null)
| 118 + {
| 119 + mergeScopes(scopeInfo.getScope(), unit.getScope());
| 120 + mergeScopes(scopeInfo.getMutableScope(), unit.getMutableScope());
| 121 + }
| 115 122 try
| 116 123 {
| 117 124 controller.install(context);
|
|
| !
|
|
|
| â¦
|
| 122 129 }
| 123 130 }
| 124 131
| <> 132 + /**
| 133 + * Merge scope keys.
| 134 + *
| 135 + * @param contextKey the context key
| 136 + * @param unitKey the unit key
| 137 + */
| 138 + protected static void mergeScopes(ScopeKey contextKey, ScopeKey unitKey)
| 139 + {
| 140 + if (contextKey == null)
| 141 + return;
| 142 + if (unitKey == null)
| 143 + return;
| 144 +
| 145 + Collection<Scope> unitScopes = unitKey.getScopes();
| 146 + if (unitScopes == null || unitScopes.isEmpty())
| 147 + return;
| 148 +
| 149 + for (Scope scope : unitScopes)
| 150 + contextKey.addScope(scope);
| 151 + }
|
But like I posted on the jboss-dev:
"alesj wrote :
| The JBossAS5_trunk now boots fine with all MC snapshots.
| My demos also work. :-)
|
| But I haven't closed JBDEPLOY-69 yet.
| Any other corner case we can think of?
|
I'll add a test for annotated beans in deployers first.
And Kabir should/could also add some test exposing his work.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169556#4169556
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169556
17 years, 8 months
[Design of JBoss/Tomcat Integration] - Re: JBAS-5673 - Metadata processing
by scott.stark@jboss.org
According to the jsp2.1 spec there are:
"jsp-2.1" wrote :
| In the JSP speciï¬cation, tag handlers which implement interfacesjavax.serv-
| let.jsp.tagext.Tag andjavax.servlet.jsp.tagext.SimpleTag may be annotated for injection. In both cases, injection occurs immediately after an instance of the tag handler is constructed, and before any of the tag properties are initialized.
| Event Listeners (See Section JSP.7.1.9, âEvent Listenersâ) can also be
| annotated for resource injection. Injection occurs immediately after an instance of the event handler is constructed, and before it is registered.
| The annotations supported are:
| ⢠@EJB, @EJBs
| ⢠@PersistenceContext, @PersistenceContexts
| ⢠@PersistenceUnit, @PersistenceUnits
| ⢠@PostConstruct, @PreDestroy
| ⢠@Resource,@Resources
| ⢠@WebServiceRef, @WebServiceRefs
|
I assigned JBAS-4399 to you to ensure the annotation processing is happening in one place.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169554#4169554
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169554
17 years, 8 months
[Design of POJO Server] - Re: Integrating aop-mc-int bean metadata with AS5
by adrian@jboss.org
"adrian(a)jboss.org" wrote :
| You're main problem is that you are not using the BeanMetaDataDeployer
| (or whatever code you copied from it) properly.
|
| The BeanMetaDataDeployer is designed to be run against a Component deployment
| which will have a mutable INSTANCE scope. You're running it against the top level
| deployment which has a mutable scope of the whole APPLICATION.
|
A quick hack for you (though not the correct fix)
would be to change your ScopeInfo initialization code to something like:
| // Create an instance scope
| ScopeKey instanceScope = new ScopeKey(new Scope(CommonLevels.INSTANCE, controllerContext.getName()));
|
| // Add the instance to the deployment scope
| ScopeKey deploymentScope = unit.getScope();
| scope = deploymentScope.clone();
| scope.addScope(instanceScope);
|
| // Set the hacked scopes on the controller context
| ScopeInfo scopeInfo = controllerContext.getScopeInfo();
| scopeInfo.setScope(scope);
| scopeInfo.setMutableScope(instanceScope);
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169546#4169546
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169546
17 years, 8 months