How to get mbean-based SAR that deployed in EAP 5.2 to deploy on EAP 6.x?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
A SAR project was created with 2 mbean classes configured in the jboss-service.xml. The attached project is test.sar.
The 2 mbean classes (TestValueFactory & OtherValueFactory) are configured in the jboss-service.xml file. In accordance with our wishes, the TestValueFactory mbean is configured in this file such that it gets configuration information information from the OtherValueFactory mbean (done using the
Deployment of test.sar worked in JBoss EAP 5.2 but failed in JBoss EAP 6.4.0 with the following error:
10:13:13,263 WARN [org.jboss.msc.inject] (MSC service thread 1-14) MSC000100: Unexpected failure to uninject public void com.test.redhat.mbean.TestValueFactory.setCustName(java.lang.String): java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45]
at org.jboss.msc.value.MethodValue.getValue(MethodValue.java:62) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
...
10:13:13,264 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC000001: Failed to start service jboss.mbean.service.test:type=SarTestValueFactory.create: org.jboss.msc.service.StartException in service jboss.mbean.service.test:type=SarTestValueFactory.create: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1936) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_45]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_45]
Caused by: org.jboss.msc.inject.InjectionException: Injection failed
at org.jboss.msc.inject.MethodInjector.inject(MethodInjector.java:102) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1704) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl.access$2000(ServiceControllerImpl.java:52) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1949) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1908) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
... 3 more
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_45]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_45]
at org.jboss.msc.value.MethodValue.getValue(MethodValue.java:62) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.value.CachedValue.getValue(CachedValue.java:54) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.value.Values.getValues(Values.java:68) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.value.Values.getValues(Values.java:82) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.inject.MethodInjector.inject(MethodInjector.java:92) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
... 7 more
The attached test.sar file (called test_sar.tar should be renamed to test.sar before extracting) includes the jboss-service.xml used along with jboss-service.xml files for EAP5 and EAP6.
Resolution
The configuration in test.sar for EAP6 appears to be correct. There is a bug in EAP 6.x which prevents the successful deployment of this mbean test case. This bug was addressed and resolved in This content is not included.Bugzilla 1329314
To resolve this issue, download the attached Patch.zip file which contains the patch so that test.sar deploys in EAP 6.x.
To apply this individual patch, follow the steps outlined in How do I apply individual or cumulative patches in JBoss EAP 6.2 and beyond [1]?
To rollback this individual patch if installation has unexpected consequences, follow the steps outlined in How do I rollback individual or cumulative patches in JBoss EAP 6.2 and beyond [2]?
[1] https://access.redhat.com/site/solutions/625683
[2] https://access.redhat.com/site/solutions/639403
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.