2 Replies Latest reply: Jul 30, 2013 2:37 AM by gimbal2 RSS

    NullPointerException When trying to Get Session Scoped Bean data in another ManagedBean

    sofiane

      hello

      i wont to access to some data in my session scoped bean from a request bean so when i try to get this data all i get is 

      com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection
      on managed bean
      «discussionlaoder»


      in the end of the exception there is

      Caused by: java.lang.NullPointerException at Hiber.discussionlaoder.init(discussionlaoder.java:35)



      this is my code:

      1-the request scoped bean

       

      @ManagedBean
      @RequestScoped
      public class discussionlaoder {

        private MyadmninHelper halper;

      @ManagedProperty(value="#{serviceBean}")
           private ServicesBean  serviceBean;
          @PostConstruct
          public void init() {
            halper=getServiceBean().getHalper();  // line 35

       

          }

      //seter and geter code

      }

       

      2-the sesions scoped bean

       

      @ManagedBean (eager=true)
      @SessionScoped
      public class ServicesBean {

            
        
          private MyadmninHelper halper;

      //seter and geter code

      }

       

      am using glassfish server 3.1

      thank's for help