java.lang.NullPointerException

JBoss Issue Tracker | Bartosz Spyrko-Śmietanko | 7 months ago
  1. 0

    If using a <value-factory> or <inject> element with "parameter" attribute in jboss-service.xml to inject a value from one bean to another, a "java.lang.IllegalArgumentException: object is not an instance of declaring class" error is raised during deployment. jboss-service.xml {noformat} <server xmlns="urn:jboss:service:7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd"> <mbean code="com.test.redhat.mbean.OtherValueFactory" name="test:type=OtherValueFactory"> <attribute name="WelcomeString">Welcome</attribute> <attribute name="CustName">Other</attribute> </mbean> <mbean code="com.test.redhat.mbean.TestValueFactory" name="test:type=SarTestValueFactory"> <depends>test:type=OtherValueFactory</depends> <attribute name="WelcomeString">Welcome</attribute> <attribute name="CustName"> <value-factory bean="test:type=OtherValueFactory" method="getNameOfCustomer"> <parameter class="java.lang.String">Foo</parameter> </value-factory> </attribute> </mbean> </server> {noformat} Full error: {noformat} 16:54:36,505 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "test.sar" (runtime-name: "test.sar") 16:54:36,690 WARN [org.jboss.msc.inject] (MSC service thread 1-2) 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) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.jboss.msc.value.MethodValue.getValue(MethodValue.java:62) at org.jboss.msc.value.CachedValue.getValue(CachedValue.java:54) at org.jboss.msc.value.Values.getValues(Values.java:68) at org.jboss.msc.value.Values.getValues(Values.java:82) at org.jboss.msc.inject.MethodInjector.uninject(MethodInjector.java:119) at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1923) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1876) 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) 16:54:36,691 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) 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:1904) 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: org.jboss.msc.inject.InjectionException: Injection failed at org.jboss.msc.inject.MethodInjector.inject(MethodInjector.java:102) at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1672) at org.jboss.msc.service.ServiceControllerImpl.access$2000(ServiceControllerImpl.java:51) at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1917) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1876) ... 3 more Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class 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:497) at org.jboss.msc.value.MethodValue.getValue(MethodValue.java:62) at org.jboss.msc.value.CachedValue.getValue(CachedValue.java:54) at org.jboss.msc.value.Values.getValues(Values.java:68) at org.jboss.msc.value.Values.getValues(Values.java:82) at org.jboss.msc.inject.MethodInjector.inject(MethodInjector.java:92) ... 7 more 16:54:36,697 INFO [com.test.redhat.mbean.OtherValueFactory] (ServerService Thread Pool -- 58) >> TestValuFactory.start() invoked 16:54:36,698 INFO [stdout] (ServerService Thread Pool -- 58) TestValuFactory.start() invoked 16:54:36,776 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "test.sar")]) - failure description: {"WFLYCTL0080: Failed services" => {"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 Caused by: org.jboss.msc.inject.InjectionException: Injection failed Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class"}} {noformat}

    JBoss Issue Tracker | 7 months ago | Bartosz Spyrko-Śmietanko
    java.lang.NullPointerException
  2. 0

    Java compiling create class file with class name followed by '$1'

    Stack Overflow | 1 year ago | commented-developer
    java.lang.reflect.InvocationTargetException
  3. 0

    NullPointerException in Unit Test with Arquillian

    Stack Overflow | 1 year ago | Jomikel
    java.lang.AssertionError: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  1. tyson925 1 times, last 1 month ago
  2. ajinkya_w 2 times, last 1 month ago
  3. Ajeet 8 times, last 3 months ago
  4. qavid 2 times, last 5 months ago
  5. Nikolay Rybak 11 times, last 6 months ago
2 more registered users
11 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NullPointerException

    No message provided

    at sun.reflect.NativeMethodAccessorImpl.invoke0()
  2. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:497)
    4 frames
  3. JBoss Modular Service Container
    ServiceControllerImpl$StartTask.run
    1. org.jboss.msc.value.MethodValue.getValue(MethodValue.java:62)
    2. org.jboss.msc.value.CachedValue.getValue(CachedValue.java:54)
    3. org.jboss.msc.value.Values.getValues(Values.java:68)
    4. org.jboss.msc.value.Values.getValues(Values.java:82)
    5. org.jboss.msc.inject.MethodInjector.uninject(MethodInjector.java:119)
    6. org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1923)
    7. org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1876)
    7 frames
  4. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    3. java.lang.Thread.run(Thread.java:745)
    3 frames