[
https://issues.apache.org/jira/browse/FELIX-2944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13041565#comment-13041565
]
Felix Meschberger commented on FELIX-2944:
------------------------------------------
Fixed namespace URI in the SCR plugin (generator) Rev. 1129654.
To test this you can add a dependency to the SCR generator SNAPSHOT build in
the SCR plugin configuration, e.g.:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.0</version>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.generator</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
> 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), Maven SCR Plugin
> Affects Versions: maven-scr-plugin-1.7.0, scr-1.6.0
> Reporter: Pierre De Rop
> Assignee: Felix Meschberger
> Priority: Minor
>
> This issue is described in the following post:
> http://www.mail-archive.com/[email protected]/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