karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-1797) NPE thrown from OsgiConfiguration.unregister
Date Mon, 10 Sep 2012 08:14:08 GMT

    [ https://issues.apache.org/jira/browse/KARAF-1797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451811#comment-13451811
] 

Guillaume Nodet commented on KARAF-1797:
----------------------------------------

The real cause of the NPE is because the call to obtain the real service in the blueprint
proxy can return null in some cases:

https://github.com/apache/aries/blob/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/ReferenceListRecipe.java#L207

This is because when the service is being unregistered, the reference inside the proxy will
be valid, but the service not available.  Given the above code does not check for the service
returned not being null, we have this NPE.  So this should be fixed in Blueprint.

However, this also means that the equals method on proxies can't be used reliably, so proxies
need to be wrapped into an object that will check Object equality on proxies rather than the
proxied objects are equals.
                
> NPE thrown from OsgiConfiguration.unregister
> --------------------------------------------
>
>                 Key: KARAF-1797
>                 URL: https://issues.apache.org/jira/browse/KARAF-1797
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-core
>    Affects Versions: 2.2.5
>            Reporter: Stan Lewis
>            Assignee: Guillaume Nodet
>             Fix For: 2.2.10, 2.3.0, 3.0.0
>
>
> Passing in a null value for "realm" to unregister causes:
> 2012-09-06 09:35:00,700 | ERROR | -70-091-thread-1 | tServiceReferenceRecipe$Listener
| 8 - org.apache.aries.blueprint - 0.3.1.fuse-70-091 | Error calling listener method public
void org.apache.karaf.jaas.config.impl.OsgiConfiguration.unregister(org.apache.karaf.jaas.config.JaasRealm,java.util.Map)
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_33]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_33]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_33]
> at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_33]
> at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:284)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.invokeMethods(AbstractServiceReferenceRecipe.java:461)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$Listener.unbind(AbstractServiceReferenceRecipe.java:430)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.unbind(AbstractServiceReferenceRecipe.java:333)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.ReferenceListRecipe.untrack(ReferenceListRecipe.java:144)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.serviceRemoved(AbstractServiceReferenceRecipe.java:275)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.access$200(AbstractServiceReferenceRecipe.java:64)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$1.run(AbstractServiceReferenceRecipe.java:245)[8:org.apache.aries.blueprint:0.3.1.fuse-70-091]
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_33]
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_33]
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_33]
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_33]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_33]
> at java.lang.Thread.run(Thread.java:680)[:1.6.0_33]
> Caused by: java.lang.NullPointerException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_33]
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_33]
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_33]
> at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_33]
> at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)
> at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)
> at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)
> at $Proxy11.equals(Unknown Source)[13:org.apache.karaf.jaas.config:2.2.5.fuse-70-091]
> at java.util.concurrent.CopyOnWriteArrayList.eq(CopyOnWriteArrayList.java:131)[:1.6.0_33]
> at java.util.concurrent.CopyOnWriteArrayList.remove(CopyOnWriteArrayList.java:484)[:1.6.0_33]
> at org.apache.karaf.jaas.config.impl.OsgiConfiguration.unregister(OsgiConfiguration.java:48)[13:org.apache.karaf.jaas.config:2.2.5.fuse-70-091]
> ... 18 more
> However there's some valid cases for this if the service is optional and not available.
 In my case it appears to be happening as part of installing a second jaas module.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message