Menu

#171 NPE from ServiceURLStreamHandlerFactory.getServiceHandler

trunk
closed-fixed
nobody
None
5
2013-02-07
2013-02-04
Jan Stein
No

I am running into issues while running GlassFish on Knopflerfish. In our case, we are seeing an NPE as described below when we create another instance of framework in the same JVM after stopping the first one. I repeat, we create the second framework after ensuring that the first framework instance has been stopped. Yet, looking at knopflerfish code corresponding to the stack, it is clear to me that the JVM wide singleton instance of type ServiceURLStreamHandlerFactory is using the framework object.

Caused by: java.lang.NullPointerException
at org.knopflerfish.framework.ServiceURLStreamHandlerFactory.getServiceHandler(ServiceURLStreamHandlerFactory.java:201)
at org.knopflerfish.framework.ServiceURLStreamHandlerFactory.createURLStreamHandler(ServiceURLStreamHandlerFactory.java:129)
at java.net.URL.getURLStreamHandler(URL.java:1150)
at java.net.URL.(URL.java:411)
at sun.misc.URLClassPath$JarLoader.(URLClassPath.java:604)
at sun.misc.URLClassPath$3.run(URLClassPath.java:362)
at sun.misc.URLClassPath$3.run(URLClassPath.java:352)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:351)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:328)
at sun.misc.URLClassPath.getResource(URLClassPath.java:194)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:410)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

To reproduce, do the following:
Using R4 API, create an instance of org.osgi.framework.lunch.Framework object.
Init it, Start it, Stop it and Wait for it to start.
Now, create another instance of org.osgi.framework.lunch.Framework object. You will see this framework instance is appended to the list of Framework instances maintained by ServiceURLStreamHandlerFactory. Any URL operations now will try to use the stopped framework instance and get NPE.
Sahoo

Discussion

  • Gunnar Ekolin

    Gunnar Ekolin - 2013-02-07
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     I am running into issues while running GlassFish on Knopflerfish. In our case, we are seeing an NPE as described below when we create another instance of framework in the same JVM after stopping the first one. I repeat, we create the second framework after ensuring that the first framework instance has been stopped. Yet, looking at knopflerfish code corresponding to the stack, it is clear to me that the JVM wide singleton instance of type ServiceURLStreamHandlerFactory is using the framework object.
    
     Caused by: java.lang.NullPointerException
    
    • status: open --> closed-fixed
     
  • Gunnar Ekolin

    Gunnar Ekolin - 2013-02-07

    Fixed on trunk in revision 3740.

     

Log in to post a comment.

MongoDB Logo MongoDB