Menu

NPE from ServiceURLStreamHandlerFactory.getServiceHandler

Sahoo
2013-02-03
2013-02-07
  • Sahoo

    Sahoo - 2013-02-03

    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.<init>(URL.java:411)
    at sun.misc.URLClassPath$JarLoader.<init>(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)</init></init>

    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

     
  • Jan Stein

    Jan Stein - 2013-02-04

    This is a bug in the ServiceURLStreamHandler, it doesn't handle stopped framework instances correctly. I've created a ticket for this:

    https://sourceforge.net/p/gatespace/bugs/171

     
  • Gunnar Ekolin

    Gunnar Ekolin - 2013-02-07

    This problem is now fixed.
    The fix is available on the trunk and in nightly builds as of today.
    Nightly builds are available on http://www.knopflerfish.org/snapshots/

     

Log in to post a comment.

MongoDB Logo MongoDB