felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre De Rop (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-2944) SCR/ spec version 1.1-felix is causing NPE in XmlHandler
Date Thu, 05 May 2011 14:15:03 GMT
SCR/ spec version 1.1-felix is causing NPE in XmlHandler
--------------------------------------------------------

                 Key: FELIX-2944
                 URL: https://issues.apache.org/jira/browse/FELIX-2944
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
            Reporter: Pierre De Rop
            Priority: Minor


This issue is described in the following post: http://www.mail-archive.com/users@felix.apache.org/msg10138.html
and might also be related in the  FELIX-1898 issue.

When using SCR (trunk) and the new Reference "updated" callback, we have to specify the spec
version "1.1-felix". 
However, when using such version, we get the following NPE at runtime: (latest scrplugin has
been used to generate the scr xml descriptor):

java.lang.NullPointerException
        at org.apache.felix.scr.impl.metadata.XmlHandler.startElement(XmlHandler.java:237)
        at org.apache.felix.scr.impl.parser.KXml2SAXParser.parseXML(KXml2SAXParser.java:73)
        at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:227)
        at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
        at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
        at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:274)
        at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:192)
        at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3833)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1803)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1179)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Thread.java:662)

Notice that this exception is displayed on stdout, and it would be probably better to log
it using the log service;
>From log service, we then get the following exception:

.scr.impl.parser.ParseException: Exception during parsing
        at org.apache.felix.scr.impl.metadata.XmlHandler.startElement(XmlHandler.java:333)
        at org.apache.felix.scr.impl.parser.KXml2SAXParser.parseXML(KXml2SAXParser.java:73)
        at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:227)
        at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
        at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
        at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:274)
        at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:192)
        at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3833)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1803)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1179)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Thread.java:662)

I think that the root cause of the problem is that the scrplugin is generating the following
xml namespace:

    http://www.osgi.org/xmlns/scr/v1.1.0-felix

but the scr runtime is expecting the following namespace:

    http://felix.apache.org/xmlns/scr/v1.1.0-felix

so, there is a mismatch here.
The following patch seems to work and consists in fixing the class XmlHandler.java, in the
SCR: 
The XmlHandler.NAMESPACE_URI_1_1_FELIX constant can be changed with the following scheme (which
must match the one generated by the scrplugin):

    public static final String NAMESPACE_URI_1_1_FELIX = "http://www.osgi.org/xmlns/scr/v1.1.0-felix";

Or another option is to fix the scrplugin in order to use the felix.apache.org scheme ?


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message