2 Replies Latest reply on Apr 17, 2007 4:59 AM by pmuir

    @Logger not injecting anything in Controller.class

    paradigmza

      Hi,

      I have a simple piece of code that is trying to persist/update the database

      VweraclientdnamesHome home = new VweraclientdnamesHome();
      home.setVweraclientdnamesId(input.getId());
      home.getInstance().setUsedForEras(true);
      home.update();
      


      where home is a instance of the EntityHome class

      When I run this code I get this null pointer


      Caused by: java.lang.NullPointerException
      at org.jboss.seam.framework.Controller.debug(Controller.java:183)
      at org.jboss.seam.framework.Home.updatedMessage(Home.java:40)
      at org.jboss.seam.framework.EntityHome.update(EntityHome.java:40)
      at coza.healthbridge.mypractice.admin.beans.session.EraClientDnamesBean.updateUsedForEras(EraClientDnamesBean.java:62)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


      and stepping through a debug it looks like the @Logger is not injecting the object in Controller.class

      Any ideas?

      I used seam gen (1.2.1) to generate the project and the entities.
      I then added another persistance unit to connect to another DB.
      I can view all the CRUD pages for both PU's
      I then just added this update code, and it is not working (I used seam 1.5 before this and the update code worked with seam gen)

      Thanks
      Sean.


        • 1. Re: @Logger not injecting anything in Controller.class
          paradigmza

          I just commented out the debug line in the source code, and everything is working perfecly, im not sure what to do from here, except use my custom built seam. (I don't really understand how the injection actually works)

           protected <T> ClassValidator<T> getValidator(Class<T> modelClass)
           {
           return Model.forClass(modelClass).getValidator();
           }
          
           protected void debug(Object object, Object... params)
           {
           //log.debug(object, params);
           }
          
           protected void debug(Object object, Throwable t, Object... params)
           {
           log.debug(object, t, params);
           }
          


          • 2. Re: @Logger not injecting anything in Controller.class
            pmuir

            Seam can't do it's magic if you use new to instantiate a Seam component. You need to use injection (or Component.getInstance())