You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by László Hordós <la...@forgerock.com> on 2013/02/24 15:23:07 UTC

NPE with maven-scr-plugin 1.10.0

Hi,

I just updated to maven-scr-plugin:1.10.0 and org.apache.felix.scr.annotations:1.8.0 and I have this component:

@Component(name = "org.example.component", immediate = true, policy = ConfigurationPolicy.IGNORE)
public final class ContextRegistrator {

    @Reference
    HttpService httpService;

}

I didn't have the bind/unbind method but the plugin generated the names and put them into the Descriptor. The build was success but then it didn't work because SCR didn't find the non existing methods so I added the generateAccessors property to the plugin:

                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-scr-plugin</artifactId>
                    <version>1.10.0</version>
                    <configuration>
                        <generateAccessors>false</generateAccessors>
                    </configuration>
                </plugin>

When I build the project now it fails with this exception. 

Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.10.0:scr (generate-scr-scrdescriptor) on project openidm-httpcontext: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: java.lang.NullPointerException
	at org.apache.felix.scrplugin.helper.Validator.validateMethod(Validator.java:523)
	at org.apache.felix.scrplugin.helper.Validator.validateReference(Validator.java:465)
	at org.apache.felix.scrplugin.helper.Validator.validate(Validator.java:189)
	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:214)
	at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:248)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	... 20 more


If I add these methods then it works.

    private void bindWebContainer(WebContainer service) {
       httpService = service;
    }

    private void unbindWebContainer(WebContainer service) {
        httpService = null;
    }

If I make a typo mistake in the name of one of these two methods I get NPE again. If I remove the generateAccessors property and the new methods the plugin "works" again and generate broken Descriptor. It checks when It shouldn't and It does not check when it should.

I see there is an integration test src/it/basic-build-it/src/main/java/org/apache/felix/scr/SimpleDSComponent.java but it does not validates the generated Descriptor. 

Regards,
Laszlo


Re: NPE with maven-scr-plugin 1.10.0

Posted by Carsten Ziegeler <cz...@apache.org>.
Yes, unfortunately the 1.10.0 version of the scr plugin is broken :(
I just started a vote for 1.11.0 which fixes this problem.

Carsten

2013/2/26 László Hordós <la...@forgerock.com>:
> Thank you, I didn't have the time to create the issue. It's not related to the final, it's an unfortunate the first problem occurred on a final class and I didn't pay attention when I wrote the example. I happens on a plain public class and I'm sure the integration test would fail with this configuration.
>
> On 25 Feb 2013, at 13:02, Carsten Ziegeler wrote:
>
>> I've created and fixed FELIX-3917 for the NPE, however if this problem
>> is related to the class being final (as suspected by Felix) please
>> create an issue for this.
>>
>> Thanks
>> Carsten
>>
>> 2013/2/24 Felix Meschberger <fm...@adobe.com>:
>>> Hi,
>>>
>>> (1) The NPE is certainly not good. The plugin should just report the missing methods if they are not generated. May I ask you to report an issue ? Thanks.
>>>
>>> (2) The first case might be caused by the plugin not generating the methods because of the class being final. Could you try not declaring the class final ? If that works, I would assume the plugin should properly complain and fail the build due to missing methods.
>>>
>>> Regards
>>> Felix
>>>
>>> Am 24.02.2013 um 15:23 schrieb László Hordós:
>>>
>>>> Hi,
>>>>
>>>> I just updated to maven-scr-plugin:1.10.0 and org.apache.felix.scr.annotations:1.8.0 and I have this component:
>>>>
>>>> @Component(name = "org.example.component", immediate = true, policy = ConfigurationPolicy.IGNORE)
>>>> public final class ContextRegistrator {
>>>>
>>>>   @Reference
>>>>   HttpService httpService;
>>>>
>>>> }
>>>>
>>>> I didn't have the bind/unbind method but the plugin generated the names and put them into the Descriptor. The build was success but then it didn't work because SCR didn't find the non existing methods so I added the generateAccessors property to the plugin:
>>>>
>>>>               <plugin>
>>>>                   <groupId>org.apache.felix</groupId>
>>>>                   <artifactId>maven-scr-plugin</artifactId>
>>>>                   <version>1.10.0</version>
>>>>                   <configuration>
>>>>                       <generateAccessors>false</generateAccessors>
>>>>                   </configuration>
>>>>               </plugin>
>>>>
>>>> When I build the project now it fails with this exception.
>>>>
>>>> Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed. NullPointerException -> [Help 1]
>>>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.10.0:scr (generate-scr-scrdescriptor) on project openidm-httpcontext: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
>>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>>>      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>>>      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>>>      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>>>>      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>>>      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>>>>      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>>>      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>>>> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
>>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>>>      ... 19 more
>>>> Caused by: java.lang.NullPointerException
>>>>      at org.apache.felix.scrplugin.helper.Validator.validateMethod(Validator.java:523)
>>>>      at org.apache.felix.scrplugin.helper.Validator.validateReference(Validator.java:465)
>>>>      at org.apache.felix.scrplugin.helper.Validator.validate(Validator.java:189)
>>>>      at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:214)
>>>>      at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:248)
>>>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>>>>      ... 20 more
>>>>
>>>>
>>>> If I add these methods then it works.
>>>>
>>>>   private void bindWebContainer(WebContainer service) {
>>>>      httpService = service;
>>>>   }
>>>>
>>>>   private void unbindWebContainer(WebContainer service) {
>>>>       httpService = null;
>>>>   }
>>>>
>>>> If I make a typo mistake in the name of one of these two methods I get NPE again. If I remove the generateAccessors property and the new methods the plugin "works" again and generate broken Descriptor. It checks when It shouldn't and It does not check when it should.
>>>>
>>>> I see there is an integration test src/it/basic-build-it/src/main/java/org/apache/felix/scr/SimpleDSComponent.java but it does not validates the generated Descriptor.
>>>>
>>>> Regards,
>>>> Laszlo
>>>>
>>>
>>>
>>> --
>>> Felix Meschberger | Principal Scientist | Adobe
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>>
>>
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>>
>> ---------------------------------------------------------------------
>> 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
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: NPE with maven-scr-plugin 1.10.0

Posted by László Hordós <la...@forgerock.com>.
Thank you, I didn't have the time to create the issue. It's not related to the final, it's an unfortunate the first problem occurred on a final class and I didn't pay attention when I wrote the example. I happens on a plain public class and I'm sure the integration test would fail with this configuration. 

On 25 Feb 2013, at 13:02, Carsten Ziegeler wrote:

> I've created and fixed FELIX-3917 for the NPE, however if this problem
> is related to the class being final (as suspected by Felix) please
> create an issue for this.
> 
> Thanks
> Carsten
> 
> 2013/2/24 Felix Meschberger <fm...@adobe.com>:
>> Hi,
>> 
>> (1) The NPE is certainly not good. The plugin should just report the missing methods if they are not generated. May I ask you to report an issue ? Thanks.
>> 
>> (2) The first case might be caused by the plugin not generating the methods because of the class being final. Could you try not declaring the class final ? If that works, I would assume the plugin should properly complain and fail the build due to missing methods.
>> 
>> Regards
>> Felix
>> 
>> Am 24.02.2013 um 15:23 schrieb László Hordós:
>> 
>>> Hi,
>>> 
>>> I just updated to maven-scr-plugin:1.10.0 and org.apache.felix.scr.annotations:1.8.0 and I have this component:
>>> 
>>> @Component(name = "org.example.component", immediate = true, policy = ConfigurationPolicy.IGNORE)
>>> public final class ContextRegistrator {
>>> 
>>>   @Reference
>>>   HttpService httpService;
>>> 
>>> }
>>> 
>>> I didn't have the bind/unbind method but the plugin generated the names and put them into the Descriptor. The build was success but then it didn't work because SCR didn't find the non existing methods so I added the generateAccessors property to the plugin:
>>> 
>>>               <plugin>
>>>                   <groupId>org.apache.felix</groupId>
>>>                   <artifactId>maven-scr-plugin</artifactId>
>>>                   <version>1.10.0</version>
>>>                   <configuration>
>>>                       <generateAccessors>false</generateAccessors>
>>>                   </configuration>
>>>               </plugin>
>>> 
>>> When I build the project now it fails with this exception.
>>> 
>>> Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed. NullPointerException -> [Help 1]
>>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.10.0:scr (generate-scr-scrdescriptor) on project openidm-httpcontext: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>>      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>>      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>>      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>>      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>>>      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>>      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>>>      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>>      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>      at java.lang.reflect.Method.invoke(Method.java:597)
>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>>      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>>> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
>>>      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>>      ... 19 more
>>> Caused by: java.lang.NullPointerException
>>>      at org.apache.felix.scrplugin.helper.Validator.validateMethod(Validator.java:523)
>>>      at org.apache.felix.scrplugin.helper.Validator.validateReference(Validator.java:465)
>>>      at org.apache.felix.scrplugin.helper.Validator.validate(Validator.java:189)
>>>      at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:214)
>>>      at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:248)
>>>      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>>>      ... 20 more
>>> 
>>> 
>>> If I add these methods then it works.
>>> 
>>>   private void bindWebContainer(WebContainer service) {
>>>      httpService = service;
>>>   }
>>> 
>>>   private void unbindWebContainer(WebContainer service) {
>>>       httpService = null;
>>>   }
>>> 
>>> If I make a typo mistake in the name of one of these two methods I get NPE again. If I remove the generateAccessors property and the new methods the plugin "works" again and generate broken Descriptor. It checks when It shouldn't and It does not check when it should.
>>> 
>>> I see there is an integration test src/it/basic-build-it/src/main/java/org/apache/felix/scr/SimpleDSComponent.java but it does not validates the generated Descriptor.
>>> 
>>> Regards,
>>> Laszlo
>>> 
>> 
>> 
>> --
>> Felix Meschberger | Principal Scientist | Adobe
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org
> 
> ---------------------------------------------------------------------
> 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


Re: NPE with maven-scr-plugin 1.10.0

Posted by Carsten Ziegeler <cz...@apache.org>.
I've created and fixed FELIX-3917 for the NPE, however if this problem
is related to the class being final (as suspected by Felix) please
create an issue for this.

Thanks
Carsten

2013/2/24 Felix Meschberger <fm...@adobe.com>:
> Hi,
>
> (1) The NPE is certainly not good. The plugin should just report the missing methods if they are not generated. May I ask you to report an issue ? Thanks.
>
> (2) The first case might be caused by the plugin not generating the methods because of the class being final. Could you try not declaring the class final ? If that works, I would assume the plugin should properly complain and fail the build due to missing methods.
>
> Regards
> Felix
>
> Am 24.02.2013 um 15:23 schrieb László Hordós:
>
>> Hi,
>>
>> I just updated to maven-scr-plugin:1.10.0 and org.apache.felix.scr.annotations:1.8.0 and I have this component:
>>
>> @Component(name = "org.example.component", immediate = true, policy = ConfigurationPolicy.IGNORE)
>> public final class ContextRegistrator {
>>
>>    @Reference
>>    HttpService httpService;
>>
>> }
>>
>> I didn't have the bind/unbind method but the plugin generated the names and put them into the Descriptor. The build was success but then it didn't work because SCR didn't find the non existing methods so I added the generateAccessors property to the plugin:
>>
>>                <plugin>
>>                    <groupId>org.apache.felix</groupId>
>>                    <artifactId>maven-scr-plugin</artifactId>
>>                    <version>1.10.0</version>
>>                    <configuration>
>>                        <generateAccessors>false</generateAccessors>
>>                    </configuration>
>>                </plugin>
>>
>> When I build the project now it fails with this exception.
>>
>> Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed. NullPointerException -> [Help 1]
>> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.10.0:scr (generate-scr-scrdescriptor) on project openidm-httpcontext: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>       at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
>>       at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>>       at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>>       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>>       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>>       at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>>       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>>       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>>       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>       at java.lang.reflect.Method.invoke(Method.java:597)
>>       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>>       at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>>       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>>       at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
>> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
>>       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
>>       at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>>       ... 19 more
>> Caused by: java.lang.NullPointerException
>>       at org.apache.felix.scrplugin.helper.Validator.validateMethod(Validator.java:523)
>>       at org.apache.felix.scrplugin.helper.Validator.validateReference(Validator.java:465)
>>       at org.apache.felix.scrplugin.helper.Validator.validate(Validator.java:189)
>>       at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:214)
>>       at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:248)
>>       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>>       ... 20 more
>>
>>
>> If I add these methods then it works.
>>
>>    private void bindWebContainer(WebContainer service) {
>>       httpService = service;
>>    }
>>
>>    private void unbindWebContainer(WebContainer service) {
>>        httpService = null;
>>    }
>>
>> If I make a typo mistake in the name of one of these two methods I get NPE again. If I remove the generateAccessors property and the new methods the plugin "works" again and generate broken Descriptor. It checks when It shouldn't and It does not check when it should.
>>
>> I see there is an integration test src/it/basic-build-it/src/main/java/org/apache/felix/scr/SimpleDSComponent.java but it does not validates the generated Descriptor.
>>
>> Regards,
>> Laszlo
>>
>
>
> --
> Felix Meschberger | Principal Scientist | Adobe
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: NPE with maven-scr-plugin 1.10.0

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

(1) The NPE is certainly not good. The plugin should just report the missing methods if they are not generated. May I ask you to report an issue ? Thanks.

(2) The first case might be caused by the plugin not generating the methods because of the class being final. Could you try not declaring the class final ? If that works, I would assume the plugin should properly complain and fail the build due to missing methods.

Regards
Felix

Am 24.02.2013 um 15:23 schrieb László Hordós:

> Hi,
> 
> I just updated to maven-scr-plugin:1.10.0 and org.apache.felix.scr.annotations:1.8.0 and I have this component:
> 
> @Component(name = "org.example.component", immediate = true, policy = ConfigurationPolicy.IGNORE)
> public final class ContextRegistrator {
> 
>    @Reference
>    HttpService httpService;
> 
> }
> 
> I didn't have the bind/unbind method but the plugin generated the names and put them into the Descriptor. The build was success but then it didn't work because SCR didn't find the non existing methods so I added the generateAccessors property to the plugin:
> 
>                <plugin>
>                    <groupId>org.apache.felix</groupId>
>                    <artifactId>maven-scr-plugin</artifactId>
>                    <version>1.10.0</version>
>                    <configuration>
>                        <generateAccessors>false</generateAccessors>
>                    </configuration>
>                </plugin>
> 
> When I build the project now it fails with this exception. 
> 
> Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed. NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.felix:maven-scr-plugin:1.10.0:scr (generate-scr-scrdescriptor) on project openidm-httpcontext: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-scr-scrdescriptor of goal org.apache.felix:maven-scr-plugin:1.10.0:scr failed.
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> 	... 19 more
> Caused by: java.lang.NullPointerException
> 	at org.apache.felix.scrplugin.helper.Validator.validateMethod(Validator.java:523)
> 	at org.apache.felix.scrplugin.helper.Validator.validateReference(Validator.java:465)
> 	at org.apache.felix.scrplugin.helper.Validator.validate(Validator.java:189)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:214)
> 	at org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:248)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> 	... 20 more
> 
> 
> If I add these methods then it works.
> 
>    private void bindWebContainer(WebContainer service) {
>       httpService = service;
>    }
> 
>    private void unbindWebContainer(WebContainer service) {
>        httpService = null;
>    }
> 
> If I make a typo mistake in the name of one of these two methods I get NPE again. If I remove the generateAccessors property and the new methods the plugin "works" again and generate broken Descriptor. It checks when It shouldn't and It does not check when it should.
> 
> I see there is an integration test src/it/basic-build-it/src/main/java/org/apache/felix/scr/SimpleDSComponent.java but it does not validates the generated Descriptor. 
> 
> Regards,
> Laszlo
> 


--
Felix Meschberger | Principal Scientist | Adobe








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