You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by Gunnar Schmidt <eu...@googlemail.com> on 2014/10/14 07:07:45 UTC

NullPointerException when using @Secured with custom Meta-data

Hi everyone,

I'm struggling with the Deltaspike security module (v.1.0.1) when trying to
use annotations with custom meta-data. I use MyFaces (v2.2.2) and OWB
(v1.2.6) on a Tomcat 7. I get the following NullPointerException during
application deployment:

Exception sending context initialized event to listener instance of class
org.apache.webbeans.servlet.WebBeansConfigurationListener

*java.lang.NullPointerException*

       at
org.apache.deltaspike.security.impl.util.SecurityUtils.getSecurityBindingTypes(
*SecurityUtils.java:45*)

       at
org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethod(
*SecurityMetaDataStorage.java:134*)

       at
org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethods(
*SecurityMetaDataStorage.java:99*)
       at
org.apache.deltaspike.security.impl.extension.SecurityExtension.validateBindings(
*SecurityExtension.java:139*)

My annotation:

@Stereotype

@Secured(BasicActionAccessDecisionVoter.*class*)

*public* *@interface* IBasicAction {

        *int* action();

 }

Bean:

@ApplicationScoped

*public* *class* BasicActionAccessDecisionVoter *implements*
AccessDecisionVoter {



       *private* *static* *final* *long* *serialVersionUID* =
-5960947258179507982L;



       @Override

       *public* Set<SecurityViolation>
checkPermission(AccessDecisionVoterContext accessDecisionVoterContext) {

             *return* *null*;

       }
}

When I remove the parameter from my annotation, everything works fine, but
I really would like to use this feature. Am I missing something or is this
a bug?

Many thanks for your replies in advance.

Kind regards
Gunnar

Re: NullPointerException when using @Secured with custom Meta-data

Posted by Gerhard Petracek <ge...@gmail.com>.
hi gunnar,

i've fixed it (see [1]).
furthermore, i added a test for it.

regards,
gerhard

[1] https://issues.apache.org/jira/browse/DELTASPIKE-742



2014-10-14 10:06 GMT+02:00 Gerhard Petracek <ge...@gmail.com>:

> hi gunnar,
>
> it looks like an issue with owb, however, please file a jira-ticket for it
> and i'll check what we can do about it.
>
> thx & regards,
> gerhard
>
>
>
> 2014-10-14 7:07 GMT+02:00 Gunnar Schmidt <eu...@googlemail.com>:
>
>> Hi everyone,
>>
>> I'm struggling with the Deltaspike security module (v.1.0.1) when trying
>> to
>> use annotations with custom meta-data. I use MyFaces (v2.2.2) and OWB
>> (v1.2.6) on a Tomcat 7. I get the following NullPointerException during
>> application deployment:
>>
>> Exception sending context initialized event to listener instance of class
>> org.apache.webbeans.servlet.WebBeansConfigurationListener
>>
>> *java.lang.NullPointerException*
>>
>>        at
>>
>> org.apache.deltaspike.security.impl.util.SecurityUtils.getSecurityBindingTypes(
>> *SecurityUtils.java:45*)
>>
>>        at
>>
>> org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethod(
>> *SecurityMetaDataStorage.java:134*)
>>
>>        at
>>
>> org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethods(
>> *SecurityMetaDataStorage.java:99*)
>>        at
>>
>> org.apache.deltaspike.security.impl.extension.SecurityExtension.validateBindings(
>> *SecurityExtension.java:139*)
>>
>> My annotation:
>>
>> @Stereotype
>>
>> @Secured(BasicActionAccessDecisionVoter.*class*)
>>
>> *public* *@interface* IBasicAction {
>>
>>         *int* action();
>>
>>  }
>>
>> Bean:
>>
>> @ApplicationScoped
>>
>> *public* *class* BasicActionAccessDecisionVoter *implements*
>> AccessDecisionVoter {
>>
>>
>>
>>        *private* *static* *final* *long* *serialVersionUID* =
>> -5960947258179507982L;
>>
>>
>>
>>        @Override
>>
>>        *public* Set<SecurityViolation>
>> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext) {
>>
>>              *return* *null*;
>>
>>        }
>> }
>>
>> When I remove the parameter from my annotation, everything works fine, but
>> I really would like to use this feature. Am I missing something or is this
>> a bug?
>>
>> Many thanks for your replies in advance.
>>
>> Kind regards
>> Gunnar
>>
>
>

Re: NullPointerException when using @Secured with custom Meta-data

Posted by Gerhard Petracek <ge...@gmail.com>.
hi gunnar,

it looks like an issue with owb, however, please file a jira-ticket for it
and i'll check what we can do about it.

thx & regards,
gerhard



2014-10-14 7:07 GMT+02:00 Gunnar Schmidt <eu...@googlemail.com>:

> Hi everyone,
>
> I'm struggling with the Deltaspike security module (v.1.0.1) when trying to
> use annotations with custom meta-data. I use MyFaces (v2.2.2) and OWB
> (v1.2.6) on a Tomcat 7. I get the following NullPointerException during
> application deployment:
>
> Exception sending context initialized event to listener instance of class
> org.apache.webbeans.servlet.WebBeansConfigurationListener
>
> *java.lang.NullPointerException*
>
>        at
>
> org.apache.deltaspike.security.impl.util.SecurityUtils.getSecurityBindingTypes(
> *SecurityUtils.java:45*)
>
>        at
>
> org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethod(
> *SecurityMetaDataStorage.java:134*)
>
>        at
>
> org.apache.deltaspike.security.impl.extension.SecurityMetaDataStorage.registerSecuredMethods(
> *SecurityMetaDataStorage.java:99*)
>        at
>
> org.apache.deltaspike.security.impl.extension.SecurityExtension.validateBindings(
> *SecurityExtension.java:139*)
>
> My annotation:
>
> @Stereotype
>
> @Secured(BasicActionAccessDecisionVoter.*class*)
>
> *public* *@interface* IBasicAction {
>
>         *int* action();
>
>  }
>
> Bean:
>
> @ApplicationScoped
>
> *public* *class* BasicActionAccessDecisionVoter *implements*
> AccessDecisionVoter {
>
>
>
>        *private* *static* *final* *long* *serialVersionUID* =
> -5960947258179507982L;
>
>
>
>        @Override
>
>        *public* Set<SecurityViolation>
> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext) {
>
>              *return* *null*;
>
>        }
> }
>
> When I remove the parameter from my annotation, everything works fine, but
> I really would like to use this feature. Am I missing something or is this
> a bug?
>
> Many thanks for your replies in advance.
>
> Kind regards
> Gunnar
>