Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Java-SCA-1.6
-
None
Description
Invoking an SCA reference through component context API is resulting in NullPointerException. The code that is hitting this exception is running as part of the Tuscany Plugin for Geronimo. Stack trace is given below:
java.lang.NullPointerException
org.apache.tuscany.sca.implementation.java.invocation.JavaComponentContextProvider.createInstanceWrapper(JavaComponentContextProvider.java:104)
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProvider.createInstanceWrapper(JavaImplementationProvider.java:190)
org.apache.tuscany.sca.core.scope.AbstractScopeContainer.createInstanceWrapper(AbstractScopeContainer.java:65)
org.apache.tuscany.sca.core.scope.StatelessScopeContainer.getWrapper(StatelessScopeContainer.java:38)
org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:103)
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:60)
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:349)
org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
$Proxy37.sayHello(Unknown Source)
sample.HelloworldServlet.service(HelloworldServlet.java:128)
javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
Looks like this is a regression introduced by rev 833606 which has has the commit message "Improve performance by indexing invocation chains by operation and caching Java instanceFactory". The code that got changed in JavaComponentContextProvider.createInstanceWrapper() method is from
return instanceFactoryProvider.createFactory().newInstance();
to
return instanceFactory.newInstance();
The in the scenario in which the exception is occurring, instanceFactory has not been initialized by the time the createInstanceWrapper() method is called.