1 Reply Latest reply on Feb 15, 2009 2:06 AM by Fabrice Sommavilla

    jpaPermissionStore causes NPE (from seamspace example)

    Fabrice Sommavilla Newbie

      Hi,
      I've tried to implement the same permission managment as seam example Seamspace. The declaration of the permission manager component, in my components.xml is as follow:


      <security:permission-manager permission-store="#{org.jboss.seam.security.jpaPermissionStore}" />



      To retrieve available action i call permissionMnager.listAvailableActions(target); like the example:


      public List<String> getAvailableActions() {
           return permissionManager.listAvailableActions(target);
      }
      


      target is initialize before in the createPermission method and not null:


      @SuppressWarnings("unchecked")
      @Begin(nested = true)
      public void createPermission() {
           target = (Application) permissionSearch.getTarget();
           selectedUsers = new ArrayList<User>();
      
           availableUsers = entityManager.createQuery("from UserAccount ua where ua.enabled = true").getResultList();
      }



      And get the following stack trace :



      javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.NullPointerException
      java.lang.NullPointerException
           at org.jboss.seam.security.permission.JpaPermissionStore.listAvailableActions(JpaPermissionStore.java:765)
           at org.jboss.seam.security.permission.PermissionManager.listAvailableActions(PermissionManager.java:132)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)



      Any help ?


      Thank you,


      Fabrice




        • 1. Re: jpaPermissionStore causes NPE (from seamspace example)
          Fabrice Sommavilla Newbie

          Well after investigation the NPE appears at this line in the createPermission() method:


          target = (Application) permissionSearch.getTarget();



          I've declare the permissionSearch in my components.xml file this way:


          <component name="permissionSearch" auto-create="true" scope="CONVERSATION" 
                         class="org.jboss.seam.security.permission.action.PermissionSearch">
          </component>
          



          The NPE is pointed on the getTarget() method.


          What is the reason ? why getTarget() does not retrieve the Object ?


          Any help ?


          thx