[
https://issues.jboss.org/browse/WFLY-8458?page=com.atlassian.jira.plugin....
]
Chao Wang commented on WFLY-8458:
---------------------------------
At
[
ParsedServiceDeploymentProcessor.java|https://github.com/wildfly/wildfly/...],
we can add NPE check as:
{code:ParsedServiceDeploymentProcessor.java}
final Constructor<?> constructor =
mBeanClassHierarchy.get(0).getConstructor(types);
+ if(constructor == null){
+ throw
EeLogger.ROOT_LOGGER.defaultConstructorNotFound(mBeanClassHierarchy.get(0).getIndexedClass());
+ }
final Object mBeanInstance = ReflectionUtils.newInstance(constructor,
params);
{code}
to throw DeploymentUnitProcessingException instead of NPE.
When I undeployed the reproducer, I also noticed another NPE as:
{code:xml}
15:47:55,317 WARN [org.jboss.msc.inject] (ServerService Thread Pool -- 62) MSC000100:
Unexpected failure to uninject public void
org.jboss.as.quickstarts.mbeanhelloworld.mbean.PropertyManagerDynamicBean.setPropertyFile(java.lang.String)
throws java.io.IOException: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.msc.inject.MethodInjector.uninject(MethodInjector.java:119)
at
org.jboss.msc.service.ServiceControllerImpl$StopContextImpl.complete(ServiceControllerImpl.java:2623)
at org.jboss.as.service.CreateDestroyService$2.run(CreateDestroyService.java:104)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.NullPointerException
at java.io.File.<init>(File.java:360)
at
org.jboss.as.quickstarts.mbeanhelloworld.mbean.PropertyManagerDynamicBean.getPropFile(PropertyManagerDynamicBean.java:151)
at
org.jboss.as.quickstarts.mbeanhelloworld.mbean.PropertyManagerDynamicBean.load(PropertyManagerDynamicBean.java:155)
at
org.jboss.as.quickstarts.mbeanhelloworld.mbean.PropertyManagerDynamicBean.setPropertyFile(PropertyManagerDynamicBean.java:176)
... 13 more
{code}
The 2nd one above is explained at
https://issues.jboss.org/browse/WFLY-670?focusedCommentId=13028625&pa...
NPE when MBean does not have no-arg constructor
-----------------------------------------------
Key: WFLY-8458
URL:
https://issues.jboss.org/browse/WFLY-8458
Project: WildFly
Issue Type: Bug
Components: JMX, Server
Affects Versions: 11.0.0.Alpha1
Reporter: Chao Wang
Assignee: Chao Wang
NPE when MBean does not have no-arg constructor, it should log an error message
indicating the issue rather than NPE
{code}
15:05:48,605 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001:
Failed to start service
jboss.deployment.unit."jboss-helloworld-dynamicmbean-helloworld-mbean-service.sar".INSTALL:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."jboss-helloworld-dynamicmbean-helloworld-mbean-service.sar".INSTALL:
WFLYSRV0153: Failed to process phase INSTALL of deployment
"jboss-helloworld-dynamicmbean-helloworld-mbean-service.sar"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: WFLYSAR0004: Class not instantiated
at org.jboss.as.service.ReflectionUtils.newInstance(ReflectionUtils.java:133)
at
org.jboss.as.service.ParsedServiceDeploymentProcessor.newInstance(ParsedServiceDeploymentProcessor.java:283)
at
org.jboss.as.service.ParsedServiceDeploymentProcessor.addServices(ParsedServiceDeploymentProcessor.java:129)
at
org.jboss.as.service.ParsedServiceDeploymentProcessor.deploy(ParsedServiceDeploymentProcessor.java:118)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more
Caused by: java.lang.NullPointerException
at org.jboss.as.service.ReflectionUtils.newInstance(ReflectionUtils.java:131)
... 9 more
{code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)