Invoking a component reference using component context API fails with NPE
-------------------------------------------------------------------------

                 Key: TUSCANY-3447
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3447
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Java Implementation Extension
    Affects Versions: Java-SCA-1.6
            Reporter: Vamsavardhana Reddy
             Fix For: Java-SCA-1.6


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to