You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Phillips, Chad" <Ch...@gdit.com> on 2009/09/22 16:34:32 UTC

UndeclaredThrowableException when using reference

In my composite app I have ComponentA which has a reference to ComponentB.  I'm seeing an intermittent issue where ComponentA tries to invoke a method from ComponentB and an UndeclaredThrowableException is thrown.  This isn't using an official release (its 1.5.1 SNAPSHOT r810694) so this may have already been fixed.  Here is the stack trace:

java.lang.reflect.UndeclaredThrowableException
        at $Proxy234.getTaskRecord(Unknown Source)
        at test.ComponentA.performTask(ComponentA.java:213)
        at test.ComponentA$TaskRunner.run(ComponentA.java:698)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.tuscany.sca.core.scope.TargetInitializationException: java.lang.NullPointerException
        at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:65)
        at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:103)
        at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
        at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:346)
        at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
        ... 6 more
Caused by: java.lang.NullPointerException
        at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:54)
        ... 10 more

RE: UndeclaredThrowableException when using reference

Posted by "Phillips, Chad" <Ch...@gdit.com>.
Sorry about the description being vague. I'll see if I can break out that part of the system into a test case later this week.  When that exception was thrown it also put the system into a unusable state where I had to kill the java process running JBoss where the webapp was deployed (trying to shutdown JBoss had no effect).  Both component implementations are java, using the default binding, COMPOSITE scoped, and EagerInit. 
________________________________________
From: Simon Nash [nash@apache.org]
Sent: Tuesday, September 22, 2009 8:57 AM
To: user@tuscany.apache.org
Subject: Re: UndeclaredThrowableException when using reference

Phillips, Chad wrote:
> In my composite app I have ComponentA which has a reference to ComponentB.  I'm seeing an intermittent issue where ComponentA tries to invoke a method from ComponentB and an UndeclaredThrowableException is thrown.  This isn't using an official release (its 1.5.1 SNAPSHOT r810694) so this may have already been fixed.  Here is the stack trace:
>
> java.lang.reflect.UndeclaredThrowableException
>         at $Proxy234.getTaskRecord(Unknown Source)
>         at test.ComponentA.performTask(ComponentA.java:213)
>         at test.ComponentA$TaskRunner.run(ComponentA.java:698)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.tuscany.sca.core.scope.TargetInitializationException: java.lang.NullPointerException
>         at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:65)
>         at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:103)
>         at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
>         at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:346)
>         at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
>         ... 6 more
> Caused by: java.lang.NullPointerException
>         at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:54)
>         ... 10 more
>
>
Can you post a test case for this?  It looks like the original NPE is
caused by the call to AbstractScopeContainer.createInstanceWrapper()
returning null, which would happen if the implementationProvider is
not an instance of ScopedImplementationProvider.  Without more details
of the test case, it's hard to see what could be causing this.

   Simon


RE: UndeclaredThrowableException when using reference

Posted by "Phillips, Chad" <Ch...@gdit.com>.
I've been looking into this some more and I believe the source of this issue is due to some rogue threads in my app that are trying to use instances of components that have already been destroyed (as far as the Tuscany runtime is concerned).  So, based on what I've been seeing, I believe this is a problem in my app and not an issue w/ Tuscany.

-----Original Message-----
From: Simon Nash [mailto:nash@apache.org] 
Sent: Saturday, September 26, 2009 02:14
To: user@tuscany.apache.org
Subject: Re: UndeclaredThrowableException when using reference

Simon Laws wrote:
> Looking at the stack it looks like a Java implementation. But you're
> right that there is a suspicious piece of code in
> AbstractScopeContainer..
> 
>     protected InstanceWrapper createInstanceWrapper() throws
> TargetResolutionException {
>         ImplementationProvider implementationProvider =
> component.getImplementationProvider();
>         if (implementationProvider instanceof ScopedImplementationProvider) {
>             return
> ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
>         }
>         return null;
>     }
> 
> 
> Where, in the case of the CompositeScopeContainer, the null is not checked for.
> 
> Simon
> 
> 
I agree that this code looks suspicious.  However, the null won't
be returned unless implementationProvider is not an instance of
ScopedImplementationProvider.  JavaImplementationProvider does
implement the ScopedImplementationProvider interface, so this code
should not return null but should call createInstanceWrapper().
 From a quick look at the createInstanceWrapper() code, this call
should always return non-null.

   Simon


Re: UndeclaredThrowableException when using reference

Posted by Simon Nash <na...@apache.org>.
Simon Laws wrote:
> Looking at the stack it looks like a Java implementation. But you're
> right that there is a suspicious piece of code in
> AbstractScopeContainer..
> 
>     protected InstanceWrapper createInstanceWrapper() throws
> TargetResolutionException {
>         ImplementationProvider implementationProvider =
> component.getImplementationProvider();
>         if (implementationProvider instanceof ScopedImplementationProvider) {
>             return
> ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
>         }
>         return null;
>     }
> 
> 
> Where, in the case of the CompositeScopeContainer, the null is not checked for.
> 
> Simon
> 
> 
I agree that this code looks suspicious.  However, the null won't
be returned unless implementationProvider is not an instance of
ScopedImplementationProvider.  JavaImplementationProvider does
implement the ScopedImplementationProvider interface, so this code
should not return null but should call createInstanceWrapper().
 From a quick look at the createInstanceWrapper() code, this call
should always return non-null.

   Simon


Re: UndeclaredThrowableException when using reference

Posted by Simon Laws <si...@googlemail.com>.
Looking at the stack it looks like a Java implementation. But you're
right that there is a suspicious piece of code in
AbstractScopeContainer..

    protected InstanceWrapper createInstanceWrapper() throws
TargetResolutionException {
        ImplementationProvider implementationProvider =
component.getImplementationProvider();
        if (implementationProvider instanceof ScopedImplementationProvider) {
            return
((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
        }
        return null;
    }


Where, in the case of the CompositeScopeContainer, the null is not checked for.

Simon

Re: UndeclaredThrowableException when using reference

Posted by Simon Nash <na...@apache.org>.
Phillips, Chad wrote:
> In my composite app I have ComponentA which has a reference to ComponentB.  I'm seeing an intermittent issue where ComponentA tries to invoke a method from ComponentB and an UndeclaredThrowableException is thrown.  This isn't using an official release (its 1.5.1 SNAPSHOT r810694) so this may have already been fixed.  Here is the stack trace:
> 
> java.lang.reflect.UndeclaredThrowableException
>         at $Proxy234.getTaskRecord(Unknown Source)
>         at test.ComponentA.performTask(ComponentA.java:213)
>         at test.ComponentA$TaskRunner.run(ComponentA.java:698)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>         at java.lang.Thread.run(Thread.java:595)
> Caused by: org.apache.tuscany.sca.core.scope.TargetInitializationException: java.lang.NullPointerException
>         at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:65)
>         at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:103)
>         at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
>         at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:346)
>         at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:193)
>         ... 6 more
> Caused by: java.lang.NullPointerException
>         at org.apache.tuscany.sca.core.scope.CompositeScopeContainer.getWrapper(CompositeScopeContainer.java:54)
>         ... 10 more
> 
> 
Can you post a test case for this?  It looks like the original NPE is
caused by the call to AbstractScopeContainer.createInstanceWrapper()
returning null, which would happen if the implementationProvider is
not an instance of ScopedImplementationProvider.  Without more details
of the test case, it's hard to see what could be causing this.

   Simon