9 Replies Latest reply on Jun 26, 2013 8:19 AM by milesifrr

    SecurityExtension NullPointerException

    milesifrr

      Hi everybody,

       

      I am using jboss7.1.1. Based on the https://docs.jboss.org/author/display/PLINK/TicketMonster tutorial I tried to integrate picketlink in my war. I annotated my entitymanager producer with @PicketLink and I put the following dependencies in my pom.





      <dependency>



      <groupId>org.picketlink</groupId>



      <artifactId>picketlink-core-impl</artifactId>



      <version>${picketlink.version}</version>


      </dependency>


      <dependency>



      <groupId>org.picketlink</groupId>



      <artifactId>picketlink-idm-schema</artifactId>



      <version>${picketlink.version}</version>


      </dependency>

       

       

      My database is updated with the tables of the entities from the picketlink schema. But I get the following error when deploying.

       

      I get this error:

      MSC00001: Failed to start service jboss.deployment.unit."tpl.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."tpl.war".WeldService: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:

      Exception 0 :

      java.lang.NullPointerException

                at org.picketlink.deltaspike.security.impl.extension.SecurityExtension.processAnnotatedType(SecurityExtension.java:73)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

                at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

                at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

                at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

                at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)

                at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:559)

                at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:554)

                at org.jboss.solder.config.xml.bootstrap.XmlConfigExtension.beforeBeanDiscovery(XmlConfigExtension.java:139)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.lang.reflect.Method.invoke(Method.java:601)

                at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

                at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

                at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

                at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

                at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

                at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:75)

                at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:46)

                at org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl.fire(BeforeBeanDiscoveryImpl.java:46)

                at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:322)

                at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                at java.lang.Thread.run(Thread.java:722)

       

       

                at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

       

       

      I tried the beta2 version, but nothing changed. I also tried including only the dependencies as explained in the ticketmonster tutorial, but the result is the same..

      The error come from the isActivated variable of type java.lang.Boolean that is null when accessed at line 73 of SecurityExtension.java

       

          public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event)

          {

              if (!isActivated)

              {

                  return;

              }

       

       

      Do you have any idea what's going on and what I am missing?

       

      thanks for your help

       

      ciao Francesco

        • 1. Re: SecurityExtension NullPointerException
          shane.bryzak

          That's an unusual exception that I've never seen before - I'm wondering if there might be a bug in DeltaSpike's class activation feature, however looking at the ClassDeactivationUtils.initDeactivatableCacheFor() method it seems pretty straight forward.  We are actually using a fork of DeltaSpike (because at the time it was still in the Apache Incubator) however it has graduated now so for the next PicketLink release we'll be removing the forked code and importing DeltaSpike directly.  Unfortunately that doesn't help you in the meantime, so I suggest that you start by trying out the PicketLink-DeltaSpike quickstart here:

           

          https://github.com/jboss-jdf/jboss-as-quickstart/tree/master/picketlink-deltaspike-authorization

           

          If that works ok, then we can dig a little deeper into your code/project setup to find out what's going on.

          • 2. Re: SecurityExtension NullPointerException
            shane.bryzak

            Oops, I just realised that we've already removed the DeltaSpike fork from PicketLink (long weekend here so my brain is only running on minimal power).  The latest version of PicketLink is 2.5.0.Beta3, I recommend you give that a try - you'll have to import the DeltaSpike dependencies explicitly in your pom.xml.  Just copy what we have in the pom.xml of the quickstart I linked to above.

            • 3. Re: SecurityExtension NullPointerException
              milesifrr

              Hi shane,

               

              I did as yountold me... tehe are my new pom dependencies

               



              <dependency>



              <groupId>org.picketlink</groupId>



              <artifactId>picketlink-impl</artifactId>



              <version>${picketlink.version}</version>


              </dependency>


              <dependency>



              <groupId>org.picketlink</groupId>



              <artifactId>picketlink-api</artifactId>



              <version>${picketlink.version}</version>


              </dependency>


              <dependency>



              <groupId>org.picketlink</groupId>



              <artifactId>picketlink-idm-schema</artifactId>



              <version>${picketlink.version}</version>


              </dependency>






              <!-- Deltaspike API. We use compile scope as we need compile against its API -->

                      <dependency>

                          <groupId>org.apache.deltaspike.core</groupId>

                          <artifactId>deltaspike-core-api</artifactId>




              <version>${deltaspike.version}</version>

                          <scope>compile</scope>

                      </dependency>

               

               

                      <!-- Deltaspike Impl. we use runtime scope as we need its implementation

                          dependencies only on runtime -->

                      <dependency>

                          <groupId>org.apache.deltaspike.core</groupId>

                          <artifactId>deltaspike-core-impl</artifactId>




              <version>${deltaspike.version}</version>

                          <scope>runtime</scope>

                      </dependency>

               

               

                      <!-- Deltaspike Security Module API. We use compile scope as we need

                          to compile against its API -->

                      <dependency>

                          <groupId>org.apache.deltaspike.modules</groupId>

                          <artifactId>deltaspike-security-module-api</artifactId>




              <version>${deltaspike.version}</version>

                          <scope>compile</scope>

                      </dependency>

               

               

                      <!-- Deltaspike Security Impl. we use runtime scope as we need its implementation

                          dependencies only on runtime -->

                      <dependency>

                          <groupId>org.apache.deltaspike.modules</groupId>

                          <artifactId>deltaspike-security-module-impl</artifactId>




              <version>${deltaspike.version}</version>

                          <scope>runtime</scope>

                      </dependency>

               

               

              where I have

               



              <picketlink.version>2.5.0.Beta3</picketlink.version>


              <deltaspike.version>0.3-incubating</deltaspike.version>

               

              Unfortunately I get the same error....

               

              thanks for your help

               

              ciao Francesco

              • 4. Re: SecurityExtension NullPointerException
                shane.bryzak

                Hi Francesco,  did you try out the quickstart as I suggested?  Did it work successfully?

                • 5. Re: SecurityExtension NullPointerException
                  milesifrr

                  Hi Shane,

                   

                  not yet I tried to integrate it into our application. I will do it as soon as possible and let you know.

                  Anyway, do you think that upgrading from jboss 7.1.1 to the last jboss version could help me to solve my problem?

                   

                  thanks again

                   

                  ciao Francesco

                  • 6. Re: SecurityExtension NullPointerException
                    shane.bryzak

                    It's certainly worth trying to upgrade to the latest version, although if the quickstart works with 7.1.1 then it means we need to look closer at your project structure and configuration.

                    • 7. Re: SecurityExtension NullPointerException
                      milesifrr

                      Hi Shane,

                       

                      could it be that I need to upgrade the picketlink module under my jboss7 as explained here https://docs.jboss.org/author/display/PLINK/JBoss+Modules ?

                      The same doc says

                       

                      In case you are your application is dependent on PicketLink and is part of bigger EAR package use following META-INF/jboss-deployment-structure.xml as a template:

                       

                      <jboss-deployment-structure>

                       

                        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                        <sub-deployment name="THE-WAR-MODULE-THAT-REQUIRES-PICKETLINK.war">

                          <dependencies>

                            <module name="org.picketlink" />

                          </dependencies>

                        </sub-deployment>

                      </jboss-deployment-structure>


                       

                      I have a war not an ear, but, maybe, the differents picketlink verisons conflict with each other (just wondering...) and I should upgrade the current picketlink module.

                       

                      thanks again

                       

                      ciao Francesco

                      • 8. Re: SecurityExtension NullPointerException
                        shane.bryzak

                        The PicketLink module is only PicketLink Federation, and should have no effect on your deployed application.  As long as you are deploying the PicketLink 2.5.0.Beta4 jars inside your war file's WEB-INF/lib directory then it should be working for you.  Did you get a chance to try out the quickstart yet?

                        • 9. Re: SecurityExtension NullPointerException
                          milesifrr

                          Hi Shane,

                           

                          I did "git clone https://github.com/jboss-jdf/jboss-as-quickstart.git" then entered the "jboss-as-quickstart/picketlink-deltaspike-authorization" and launched "mvn clean package jboss-as:deploy", but I get this error.

                           

                           

                          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project jboss-as-picketlink-deltaspike-authorization: Compilation failure: Compilation failure:

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/annotations/Employee.java:[25,66] error: package org.apache.deltaspike.security.api.authorization.annotation does not exist

                          [ERROR]

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/annotations/Employee.java:[35,1] error: cannot find symbol

                          [ERROR]

                          [ERROR] class SecurityBindingType

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/annotations/Admin.java:[25,66] error: package org.apache.deltaspike.security.api.authorization.annotation does not exist

                          [ERROR]

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/annotations/Admin.java:[35,1] error: cannot find symbol

                          [ERROR]

                          [ERROR] class SecurityBindingType

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/CustomAuthorizer.java:[21,66] error: package org.apache.deltaspike.security.api.authorization.annotation does not exist

                          [ERROR]

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/CustomAuthorizer.java:[45,5] error: cannot find symbol

                          [ERROR]

                          [ERROR] class CustomAuthorizer

                          [ERROR] /home/milesif/tmp/jboss-as-quickstart/picketlink-deltaspike-authorization/src/main/java/org/jboss/as/quickstarts/picketlink/deltaspike/authorization/CustomAuthorizer.java:[60,5] error: cannot find symbol

                           

                          I also executed "mvn clean install '-Pdefault,!complex-dependencies'" in the quickstart root directory but I  got the same error.

                           

                          thanks again

                           

                          ciao Francesco