Uploaded image for project: 'Aries'
  1. Aries
  2. ARIES-526

NPE from ServiceRecipe when proxying JDK classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.3
    • 0.3
    • Blueprint
    • None

    Description

      The ProxyManager expects to be given a non-null Bundle when generating the proxy. Currently in some scenarios Blueprint can pass in null. Causing the following:

      [12/23/10 13:52:26:537 GMT] 00000017 ServiceRecipe I org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory getService A problem occurred trying to create a proxy object. Returning the original object instead.
      java.lang.NullPointerException
      at org.apache.aries.proxy.impl.AbstractProxyManager.getClassLoader(AbstractProxyManager.java:83)
      at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:84)
      at org.apache.aries.proxy.impl.AbstractProxyManager.createProxy(AbstractProxyManager.java:50)
      at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:463)
      at org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run(ServiceUse.java:120)
      at java.security.AccessController.doPrivileged(AccessController.java:203)

      This is caused because in TriggerServiceFactory it calls FrameworkUtil.getBundle() this returns null if the class isn't loaded from a bundle, e.g. is from the JDK, so proxying doesn't work. In this scenario we should use the blueprint bundle instead to generate the proxy.

      Attachments

        Activity

          People

            not Alasdair Nottingham
            not Alasdair Nottingham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: