5 Replies Latest reply on Dec 28, 2011 1:58 PM by Norman Valencia

    Seam Logger throws IllegalArgumentException

    infinity2heaven Novice

      I can never use the @Logger in my SFSB as I keep getting these exceptions


      
      Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: FooAction.log on: xxx.FooAction with value: class org.jboss.seam.log.LogImpl
      
           at org.jboss.seam.util.Reflections.set(Reflections.java:79)
      
           at org.jboss.seam.Component.setFieldValue(Component.java:1788)
      
      
      
      



      Declaration in my Bean is


      
      @Logger
      
      private Log log;
      
      



      It works for Stateless Beans though ...


        • 1. Re: Seam Logger throws IllegalArgumentException
          Joshua Jackson Master

          I think you should post this issue on JIRA.

          • 2. Re: Seam Logger throws IllegalArgumentException
            Joseph Miller Newbie

            I'm also seeing this issue.. was there a JIRA issue created?


            SFSB (stuff removed for readability):


            @Stateful
            @Name( "interviewController" )
            @Scope( ScopeType.CONVERSATION )
            public class InterviewControllerBean
                    implements Serializable, InterviewController
            {
            
                @Logger 
                private Log _log;
            
                @Create
                @Begin( pageflow = "New Booking" )
                public void begin()
                {
                    _log.info( "New Booking pageflow started, Booking created" );
                }
            
                @Remove
                public void remove()
                {
                }
            }





            Full stacktrace:


            org.jboss.seam.InstantiationException: Could not instantiate Seam component: interviewController
                       at org.jboss.seam.Component.newInstance(Component.java:2106)
                       at org.jboss.seam.Component.getInstance(Component.java:1988)
                       at org.jboss.seam.Component.getInstance(Component.java:1950)
                       at org.jboss.seam.Component.getInstance(Component.java:1944)
                       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
                       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
                       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
                       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
                       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
                       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
                       at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
                       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
                       at org.richfaces.component.UIDatascroller.getPage(UIDatascroller.java:483)
                       at org.richfaces.component.UIDatascroller.setupFirstRowValue(UIDatascroller.java:439)
                       at org.richfaces.component.RenderPhaseDataScrollerVisitor.afterRoot(RenderPhaseDataScrollerVisitor.java:191)
                       at org.richfaces.event.RenderPhaseComponentListener.beforePhase(RenderPhaseComponentListener.java:53)
                       at org.ajax4jsf.component.AjaxViewRoot.processPhaseListeners(AjaxViewRoot.java:185)
                       at org.ajax4jsf.component.AjaxViewRoot.encodeBegin(AjaxViewRoot.java:502)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
                       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
                       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                       at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
                       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
                       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
                       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
                       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                       at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.ejb.EJBException: java.lang.RuntimeException: java.lang.IllegalArgumentException: could not set field value: interviewController.log]
                       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1298)
                       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:763)
                       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                       at javax.naming.InitialContext.lookup(InitialContext.java:392)
                       at org.jboss.seam.Component.instantiateSessionBean(Component.java:1367)
                       at org.jboss.seam.Component.instantiate(Component.java:1331)
                       at org.jboss.seam.Component.newInstance(Component.java:2084)
                       ... 68 more
            Caused by: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.IllegalArgumentException: could not set field value: interviewController.log
                       at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:337)
                       at org.jboss.ejb3.stateful.StatefulLocalProxyFactory.createProxy(StatefulLocalProxyFactory.java:146)
                       at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53)
                       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
                       at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1273)
                       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1290)
                       ... 74 more
            Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: could not set field value: interviewController.log
                       at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:113)
                       at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:619)
                       at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:131)
                       at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:49)
                       at org.jboss.ejb3.ThreadlocalPool.create(ThreadlocalPool.java:50)
                       at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:90)
                       at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:315)
                       ... 79 more
            Caused by: java.lang.IllegalArgumentException: could not set field value: interviewController.log
                       at org.jboss.seam.Component.setFieldValue(Component.java:1894)
                       at org.jboss.seam.Component.injectLog(Component.java:1544)
                       at org.jboss.seam.Component.initialize(Component.java:1489)
                       at org.jboss.seam.intercept.RootInterceptor.postConstruct(RootInterceptor.java:67)
                       at org.jboss.seam.intercept.SessionBeanInterceptor.postConstruct(SessionBeanInterceptor.java:113)
                       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:597)
                       at org.jboss.ejb3.interceptor.LifecycleInvocationContextImpl.proceed(LifecycleInvocationContextImpl.java:131)
                       at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:109)
                       ... 85 more
            Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: InterviewControllerBean._log on: bookit.controller.InterviewControllerBean with value: class org.jboss.seam.log.LogImpl
                       at org.jboss.seam.util.Reflections.set(Reflections.java:86)
                       at org.jboss.seam.Component.setFieldValue(Component.java:1890)
                       ... 95 more
            Caused by: java.lang.IllegalArgumentException: Can not set org.jboss.seam.log.Log field bookit.controller.InterviewControllerBean._log to bookit.controller.InterviewControllerBean
                       at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
                       at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
                       at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
                       at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57)
                       at java.lang.reflect.Field.set(Field.java:657)
                       at org.jboss.seam.util.Reflections.set(Reflections.java:71)
            
            


            • 3. Re: Seam Logger throws IllegalArgumentException
              Joseph Miller Newbie

              Ok, it looks like when I compile my app through my ant script, it works fine, but when I let my IDE (IDEA 8.1) compile it, I get the error. I'm using the same JDK and settings (as far as I can see). It's very odd :(

              • 4. Re: Seam Logger throws IllegalArgumentException
                Joseph Miller Newbie

                SOLVED:


                Turns out it was a packaging problem. I had IDEA copying my compiled class files into WEB-INF/classes in my .war as well as into my EJB .jar


                Left everything just in the .jar and it's fine.

                • 5. Re: Seam Logger throws IllegalArgumentException
                  Norman Valencia Newbie

                  Hi, if can help someone.


                  changing the Log class 
                  import org.apache.commons.logging.Log
                  by
                  import org.jboss.seam.log.Log


                  -----------------------------


                  Hola, por si a alguien le puede servir.


                  A mi me funciono cambiando la clase 


                  import org.apache.commons.logging.Log
                  por
                  import org.jboss.seam.log.Log


                  Estaba importando la que no era!