You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Mike Ottinger <mo...@tacitknowledge.com> on 2011/04/17 06:55:23 UTC

getting npe from generate-scr-scrdescriptor

Hi All,

	So this is strange. In my service, if I actually declare the bindProductXMLImporter in my class, when I attempt my maven build I get the below NPE:

	java.lang.NullPointerException
	at org.apache.felix.scrplugin.tags.qdox.QDoxJavaTag.getSourceLocation(QDoxJavaTag.java:74)
	at org.apache.felix.scrplugin.om.AbstractObject.logWarn(AbstractObject.java:37)
	at org.apache.felix.scrplugin.om.Reference.validateMethod(Reference.java:259)
	at org.apache.felix.scrplugin.om.Reference.validate(Reference.java:215)
	at org.apache.felix.scrplugin.om.Component.validate(Component.java:345)
	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:334)
	at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:184)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
	....

	My service's class is annotated like the below:

	@scr.component immediate="true" metatype="no" enabled="true"
 	@scr.service interface="javax.servlet.Servlet" serviceFactory="no"
 	@scr.property name="service.description" value="PCAT importer servlet"
 	@scr.property name="service.vendor" value="Foo"
 
 	@scr.property name="sling.servlet.paths" values.0="/apps/pcat/import" 

	And the field declaration looks like:

	/**
     	* @scr.reference
     	*/
    	private ProductXMLImporter productXMLImporter;

	Everything seems to run fine, but if I declare a bind method for this by myself:

	public void bindProductXMLImporter(ProductXMLImporter productXMLImporter) {
        	this.productXMLImporter = productXMLImporter;
    	}

	I get the NPE in my maven build above. The generated serviceComponents.xml file looks perfectly fine. Any ideas?

Thanks in advance

- Mike



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: getting npe from generate-scr-scrdescriptor

Posted by Mike Ottinger <mo...@tacitknowledge.com>.
Hi All, bumping up to 1.7.0 of the SCR plugin, I did further digging and found: http://mail-archives.apache.org/mod_mbox/felix-dev/201103.mbox/%3C1643894286.4505.1299594299814.JavaMail.tomcat@hel.zones.apache.org%3E

Thanks!

On Apr 16, 2011, at 9:55 PM, Mike Ottinger wrote:

> Hi All,
> 
> 	So this is strange. In my service, if I actually declare the bindProductXMLImporter in my class, when I attempt my maven build I get the below NPE:
> 
> 	java.lang.NullPointerException
> 	at org.apache.felix.scrplugin.tags.qdox.QDoxJavaTag.getSourceLocation(QDoxJavaTag.java:74)
> 	at org.apache.felix.scrplugin.om.AbstractObject.logWarn(AbstractObject.java:37)
> 	at org.apache.felix.scrplugin.om.Reference.validateMethod(Reference.java:259)
> 	at org.apache.felix.scrplugin.om.Reference.validate(Reference.java:215)
> 	at org.apache.felix.scrplugin.om.Component.validate(Component.java:345)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:334)
> 	at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:184)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
> 	....
> 
> 	My service's class is annotated like the below:
> 
> 	@scr.component immediate="true" metatype="no" enabled="true"
> 	@scr.service interface="javax.servlet.Servlet" serviceFactory="no"
> 	@scr.property name="service.description" value="PCAT importer servlet"
> 	@scr.property name="service.vendor" value="Foo"
> 
> 	@scr.property name="sling.servlet.paths" values.0="/apps/pcat/import" 
> 
> 	And the field declaration looks like:
> 
> 	/**
>     	* @scr.reference
>     	*/
>    	private ProductXMLImporter productXMLImporter;
> 
> 	Everything seems to run fine, but if I declare a bind method for this by myself:
> 
> 	public void bindProductXMLImporter(ProductXMLImporter productXMLImporter) {
>        	this.productXMLImporter = productXMLImporter;
>    	}
> 
> 	I get the NPE in my maven build above. The generated serviceComponents.xml file looks perfectly fine. Any ideas?
> 
> Thanks in advance
> 
> - Mike
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

___________________________
Mike Ottinger
Senior Consultant
Tacit Knowledge - San Francisco
925-330-9002


Re: getting npe from generate-scr-scrdescriptor

Posted by Felix Meschberger <fm...@adobe.com>.
Hi,

I think this is a consequence of trying to warn about the public bind
method. It is not technically wrong to use a public method and there may
be a good reason to do so -- but generally it is not.

Have you tried using the Annotations instead of JavaDoc tags ?

Regards
Felix

Am Sonntag, den 17.04.2011, 05:55 +0100 schrieb Mike Ottinger: 
> Hi All,
> 
> 	So this is strange. In my service, if I actually declare the bindProductXMLImporter in my class, when I attempt my maven build I get the below NPE:
> 
> 	java.lang.NullPointerException
> 	at org.apache.felix.scrplugin.tags.qdox.QDoxJavaTag.getSourceLocation(QDoxJavaTag.java:74)
> 	at org.apache.felix.scrplugin.om.AbstractObject.logWarn(AbstractObject.java:37)
> 	at org.apache.felix.scrplugin.om.Reference.validateMethod(Reference.java:259)
> 	at org.apache.felix.scrplugin.om.Reference.validate(Reference.java:215)
> 	at org.apache.felix.scrplugin.om.Component.validate(Component.java:345)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:334)
> 	at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:184)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:454)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
> 	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:345)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:132)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:290)
> 	....
> 
> 	My service's class is annotated like the below:
> 
> 	@scr.component immediate="true" metatype="no" enabled="true"
>  	@scr.service interface="javax.servlet.Servlet" serviceFactory="no"
>  	@scr.property name="service.description" value="PCAT importer servlet"
>  	@scr.property name="service.vendor" value="Foo"
>  
>  	@scr.property name="sling.servlet.paths" values.0="/apps/pcat/import" 
> 
> 	And the field declaration looks like:
> 
> 	/**
>      	* @scr.reference
>      	*/
>     	private ProductXMLImporter productXMLImporter;
> 
> 	Everything seems to run fine, but if I declare a bind method for this by myself:
> 
> 	public void bindProductXMLImporter(ProductXMLImporter productXMLImporter) {
>         	this.productXMLImporter = productXMLImporter;
>     	}
> 
> 	I get the NPE in my maven build above. The generated serviceComponents.xml file looks perfectly fine. Any ideas?
> 
> Thanks in advance
> 
> - Mike
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org