[jboss-jira] [JBoss JIRA] (WFLY-4806) Do not deploy artifacts until subsystem MBeans are registered

Kabir Khan (JIRA) issues at jboss.org
Wed Jun 24 04:53:02 EDT 2015


    [ https://issues.jboss.org/browse/WFLY-4806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13083118#comment-13083118 ] 

Kabir Khan edited comment on WFLY-4806 at 6/24/15 4:52 AM:
-----------------------------------------------------------

The MBean proxy and the war getting deployed will happen in parallel, so there is no predefined order. You may be able to force the order by adding a dependency from the deployment onto the MBean proxy service. I think you can do that by including a ServiceActivator in your deployment. That ServiceActivator could then install a service which depends on the MBean facade. https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/wildfly/test/jmx/ServiceActivatorDeployment.java should contain what you need. You will need to declare the ServiceActivator in a META-INF/services/org.jboss.msc.service.ServiceActivator file in your deployment, and also add a META-INF/MANIFEST.MF containing this line
{code}
Dependencies: org.jboss.msc,org.jboss.as.jmx,org.jboss.as.server
{code}
You can read about that in https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly.

https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/wildfly/test/jmx/ServiceActivatorDeploymentUtil.java from our testsuite does all that, but it uses ShrinkWrap to build the archive (rather than standard maven assembly). But hopefully it shows what you need.

I am checking if there is a more declarative way although I don't think so.


was (Author: kabirkhan):
The MBean proxy and the war getting deployed will happen in parallel, so there is no predefined order. You may be able to force the order by adding a dependency from the deployment onto the MBean proxy service. I think you can do that by including a ServiceActivator in your deployment. That ServiceActivator could then install a service which depends on the MBean facade. https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/wildfly/test/jmx/ServiceActivatorDeployment.java should contain what you need. You will need to declare the ServiceActivator in a META-INF/services/org.jboss.msc.service.ServiceActivator file in your deployment, and also add a META-INF/MANIFEST.MF containing this line
{code}
Dependencies: org.jboss.msc,org.jboss.as.jmx,org.jboss.as.server
{code}
You can read about that in https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly.

https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/wildfly/test/jmx/ServiceActivatorDeploymentUtil.java from our testsuite does all that, but it uses ShrinkWrap. But hopefully it shows what you need.

I am checking if there is a more declarative way although I don't think so.

> Do not deploy artifacts until subsystem MBeans are registered
> -------------------------------------------------------------
>
>                 Key: WFLY-4806
>                 URL: https://issues.jboss.org/browse/WFLY-4806
>             Project: WildFly
>          Issue Type: Feature Request
>          Components: JMX, Server
>            Reporter: Brian Riehman
>            Assignee: Kabir Khan
>            Priority: Minor
>
> When the server starts up and begins to deploy artifacts, the subsystem MBeans are not yet available. Our application has implemented a {{ServletContextListener}} and is attempting to lookup attributes from a DataSource MBean (e.g. {{jboss.as:subsystem=datasources,xa-data-source=DefaultDS}}). This MBean is not available at the time the listener is called when the server is first starting up. Some time after the deployment has run, the MBean is available and can be queried.
> If the deployment is added after the server has already successfully started, the MBean can be queried successfully. I would imagine the deploy operation is done in parallel with the MBean registration, but I cannot find where the datasource subsystem MBean registration occurs.
> It is odd that the datasource exists but the datasources subsystem MBean is not yet available for querying.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list