1 Reply Latest reply on Nov 3, 2011 7:46 PM by rhusar

    Problem setting a dependency in a MBean ear

    a_torres

      Hi Jboss community,

       

       

      I am running with JBoss 7.0.2 and have a MBean in an ear, which is using a datasource. And the MBean will also use the datasource in the stop method. I would therefore like to add a dependency in the jboss_service.xml file where the MBean is configured, but I do not know how to do this in JBoss 7. I hope this is still possible as in previous releases of JBoss as I am getting a NullPointerException when stopping JBoss. And from what I can see then this is because the service 'PropertiesMgmtSecurityRealm' is stopped before the MBean stop method is called.

       

      The Datasource configuration looks the following way:

       

      <datasource jndi-name="java:/test/jdbc/defaultDB" pool-name="defaultDB" enabled="true" jta="true" use-java-context="true" use-ccm="true">

                ….

                          <security>

      <security-domain>

      TestDSEncryptDBPassword

      </security-domain>

      </security>

                ….

      </datasource>

       

      I then thought that the MBean configuration should have looked the following way:

       

      <mbean code="test.TestManager" name="Test:name=TestManager">

      <depends>jboss.jca:service=DataSourceBinding,name=java:/test/jdbc/defaultDB</depends>

      </mbean>

       

      The NPE is as follow:

       

      18:38:58,139 INFO [org.jboss.as.domain-management] Stopping 'PropertiesMgmtSecurityRealm' Security Realm Service

      18:38:58,139 ERROR [org.jboss.as.service] Failed to execute legacy service stop() method: java.lang.reflect.InvocationTargetException

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

      at org.jboss.as.service.AbstractService.invokeLifecycleMethod(AbstractService.java:59) [jboss-as-sar-7.0.2.Final.jar:7.0.2.Final]

      at org.jboss.as.service.StartStopService.stop(StartStopService.java:59) [jboss-as-sar-7.0.2.Final.jar:7.0.2.Final]

      at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1909) [jboss-msc-1.0.1.GA.jar:1.0.1.G

      A]

      at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1872) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]

      at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

      Caused by: java.lang.NullPointerException

      at org.jboss.security.plugins.JBossSecuritySubjectFactory.createSubject(JBossSecuritySubjectFactory.java:87)

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getSubject(AbstractConnectionManager.java:692)

      at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:466)

      at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)

       

       

      Anybody can help me here?

       

      Thank you,

      Alvaro Torres