Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EE2B94153 for ; Tue, 31 May 2011 12:55:35 +0000 (UTC) Received: (qmail 75184 invoked by uid 500); 31 May 2011 12:55:35 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 75138 invoked by uid 500); 31 May 2011 12:55:35 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 75130 invoked by uid 99); 31 May 2011 12:55:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 12:55:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 May 2011 12:55:28 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id CEBEAEB82A for ; Tue, 31 May 2011 12:54:47 +0000 (UTC) Date: Tue, 31 May 2011 12:54:47 +0000 (UTC) From: "Felix Meschberger (JIRA)" To: dev@felix.apache.org Message-ID: <107092941.55988.1306846487842.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1062939627.24634.1304604903071.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (FELIX-2944) SCR/ spec version 1.1-felix is causing NPE in XmlHandler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ 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.: org.apache.felix maven-scr-plugin 1.7.0 org.apache.felix org.apache.felix.scr.generator 1.1.1-SNAPSHOT > 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/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.(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.(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