11 Replies Latest reply on Jan 25, 2008 1:17 PM by Joseph Nusairat

    @Logger is null

    Joseph Nusairat Newbie

      Not sure why this is happening.

      I upgraded our app from Seam 1.2 to Seam 2.0.

      Went through the seam2migration document, adjusting items as needed.

      Now for some reason @Logger does not inject anything, so the log is null and hence throwing lots of NPE exceptions.

      Any ideas as to why it could be? I am sure its user error, but other items are being injected fine.

        • 1. Re: @Logger is null
          Siarhei Dudzin Apprentice

          No idea, it works fine

          • 2. Re: @Logger is null
            Pete Muir Master

            Let's see how you use @Logger.

            • 3. Re: @Logger is null
              Joseph Nusairat Newbie

              private Log log;

              i even tried

              private Log log;

              Then of course accessing it with "log.debug" ... but its the log object thats null.

              Interestingly enough I've noticed, that its only null when using it with a Session Bean. When i am using a regular Java Bean it works fine.

              I am honestly guessing its some configuration. They had Seam 1.2 here, and I'm upgrading them to Seam 2.0. They used seam-gen here before to set it up. So i have replaced ALL their old jar files with a new seam-gen's one. And I have replaced the build.xml with a new one as well.

              So this code WAS working before I started the upgrade path.

              • 4. Re: @Logger is null
                Joseph Nusairat Newbie

                you know, it looks like none of my injectable items are getting injected.

                the interceptors are working because I do see them in the stack trace.

                • 5. Re: @Logger is null
                  Nicklas Karlsson Master

                  You could try running seam-gen for 2.0.0 and copypaste the code into that structure...

                  • 6. Re: @Logger is null
                    Pete Muir Master

                    And you have @Name on the components?

                    • 7. Re: @Logger is null
                      Joseph Nusairat Newbie

                      Pete - yup i have @Name on all the componets.

                      Checking the debug window when it loads up i see it registering the component. And it accesses it via the xhtml page, which it would not be able to do if it wasnt.

                      Heck when i check the stack trace i see it passing through SeamBeanInterceptor (aroundInvoke) i believe.

                      nickarls> I actually did that for the most part. I was trying not to at first. Personally i am sure its something very stupid or its an app server issue. So i am going to deploy my "demo" i have been cutting and pasting from to upgrade and go from there.

                      Again, parts of this structure were here when i got here, but nothing stands out at me as the "issue"

                      • 9. Re: @Logger is null
                        Joseph Nusairat Newbie

                        svadu> Thanks but no. That seems to be only when you are accessing injected components in constructors. Which would make sense since those objects cant be injected before instantiation of the class.

                        Like .. here is a simple example that doesnt work -

                        public class JoeBeanImpl implements JoeBean {
                         Log log;
                         public void test() {
                         log.info("Test this shiznit");

                        produces stack trace -

                        (like 17 is the log.debug)
                        Caused by: java.lang.NullPointerException
                         at session.JoeBeanImpl.test(JoeBeanImpl.java:17)
                         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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
                         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
                         at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
                         at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:101)
                         at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                         at sun.reflect.GeneratedMethodAccessor228.invoke(Unknown Source)
                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                         at java.lang.reflect.Method.invoke(Method.java:585)
                         at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                         at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                         at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                         at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerIntercep

                        • 10. Re: @Logger is null
                          Joseph Nusairat Newbie

                          Eh FWIW .. its somekind of configuration/deployment issue on my behalf when upgrading from 1.2 to 2.0,

                          I launched my demo app and tried it, worked fine, so i know i didn't corrupt the jboss server (which i once did with jBPM and had a nightmare time figuring out why it wasnt working)

                          • 11. Re: @Logger is null
                            Joseph Nusairat Newbie

                            Anyway never mind.

                            Looks like i have the issue resolved.

                            Something with the way it was building. Their must have been some error in the building. I think it had to do with where it wsa placing webservices etc ... at least thats what i adjusted.