0 Replies Latest reply on Nov 24, 2006 6:50 AM by Peter Brewer

    Seam 1.1 @RequestParameter NullPointerException

    Peter Brewer Novice

      Since moving to Seam 1.1 (b1, b2 and cr1) I've been getting NullPointerExceptions when using the @RequestParameter annotation - I can ignore these errors and the application continues to work. However, it is filling up the logs.

      It appears to occur when destroying a component that has been annotated with @RequestParameter. What is really bizarre is that the line number being reported (line 97) is completely wrong - Parameters.java only has 74 lines in it. As far as I can tell its the only org.jboss.seam.util.Parameters class in the classpath, and decompiling the class in the class path shows that there is no line 97 (so is consistent with the source).

      I can only think I've done something horribly wrong, but I have no idea what! Any help on this one would be gratefully received. An example component and stacktrace is listed below.

      Thanks in advance, Peter

      loadMember component:

      @Stateful
      @Name("loadMember")
      @Scope(ScopeType.CONVERSATION)
      @Intercept(InterceptionType.ALWAYS)
      
      public class LoadMemberAction implements LoadMember {
      
       private static final Logger LOG = Logger.getLogger(LoadMemberAction.class);
      
       @PersistenceContext
       private EntityManager em;
      
       @In(required=false)
       @Out(required=false, scope = ScopeType.CONVERSATION)
       private Client clientProfile;
      
       @RequestParameter
       private String memberId;
      
       @Factory("clientProfile")
       @Begin(nested=true)
       public void loadProfile() {
       if (this.memberId != null) {
       clientProfile = getClient(this.memberId);
       }
       }
      
       private Client getClient(String clientId) {
       Client client = null;
       try {
       // Find the recruiter using the recruiter id from the URL
       client = em.find(Client.class, clientId);
       if ( !client.getPerson().getUser().isInRole(RoleType.Recruiter, RoleType.Directory) ) {
       throw new IllegalStateException("Client " + client.getClientId() + " does not exist in the permitted role.") ;
       } else {
       LOG.debug("Loaded client from url parameter: " + client.getClientId() + " - " + client.getCompanyName());
       }
       } catch (Exception ex) {
       LOG.error("Could not load client from URL parameter (clientId=" + clientId + ").", ex);
       }
       return client ;
       }
      
       @Remove
       @Destroy
       public void destroy() {
       // empty
       }
      
      }
      


      Stack trace
      24-11 09:04:43 WARN [Contexts] Could not destroy component: loadMember
      javax.ejb.EJBException: java.lang.NullPointerException
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:81)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:189)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy95.destroy(Unknown Source)
       at uk.co.iblocks.web.LoadMember$$FastClassByCGLIB$$c7d96f58.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:89)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:69)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
       at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:28)
       at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:287)
       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:257)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:203)
       at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:78)
       at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:47)
       at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$25a2329a.destroy(<generated>)
       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:35)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:203)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1742)
       at org.jboss.seam.Component.callDestroyMethod(Component.java:1698)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:371)
       at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:222)
       at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:89)
       at org.apache.catalina.session.StandardSession.expire(StandardSession.java:687)
       at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:579)
       at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
       at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
       at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
       at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
       at org.jboss.seam.util.Parameters.convertMultiValueRequestParameter(Parameters.java:97)
       at org.jboss.seam.Component.injectParameters(Component.java:1125)
       at org.jboss.seam.Component.inject(Component.java:1088)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:48)
       at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:157)
       at sun.reflect.GeneratedMethodAccessor152.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:45)
       at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:55)
       at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:50)
       at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.interceptors.ConversationalInterceptor.checkConversationForConversationalBean(ConversationalInterceptor.java:82)
       at sun.reflect.GeneratedMethodAccessor447.invoke(Unknown Source)
       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:35)
       at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:337)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
       at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:287)
       at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:257)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:203)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:97)
       at sun.reflect.GeneratedMethodAccessor119.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:98)
       at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       ... 63 more