5 Replies Latest reply on Mar 18, 2008 6:32 PM by nathan dennis

    NPE With Simple Persist

    nathan dennis Expert

      Jboss 4.2.2 seam 2.0.1.ga richfaces 3.1.4.ga
      i had preformed something simular successfully in seam 1.2.1. ive stared at this for 4 days,, with no luck. hopefully someone can point to where im conceptually wrong.


      @Stateful
      @Name("timelineAction")
      @Scope(ScopeType.CONVERSATION)
      public class TimelineAction implements TimelineLocal, DropListener {
           
           @PersistenceContext
           private EntityManager entityManager;
           
           @In(required = false) @Out(required=false)
              private Events newevent; 
      
      public void processDrop(DropEvent dropEvent) {
                ....
                moveFramework(dropEvent.getDragValue(), dropzone.getDropValue());
                } else{
                     log.info("drag value is null");
                }
           }
      
           @SuppressWarnings("unchecked")
           public void moveFramework(Object picturelist, Object zone) {
                log.info("top of moveFramework()");
                ArrayList<Events> target = null;
                ArrayList<Thumbnails> thumbframe = thumblist;
      
                //target = (ArrayList<Event>) eventlist.getResultList();
                //if (target != null) {
                
           //seperate the dropzone name so we know which month and year to to get
                String token = "_";
                StringTokenizer is = new StringTokenizer(zone.toString(), token, false);
           //save the month and year
                int year = Integer.valueOf( is.nextToken(token) ).intValue();          
                int month = Integer.valueOf( is.nextToken(token) ).intValue();
           //query the db to see how many events are in the selected month
                
                ArrayList<String> restrictions = new ArrayList<String>();     
                restrictions.add("eventuserid= '"+identity.getUsername() + "'");
                restrictions.add("eventyear=" + year);
                restrictions.add("month="+month);
                EventsList eventcountmonth = new EventsList();
                     eventcountmonth.setRestrictions(restrictions);
           //test to see if their are less than 9 events in the month
                     
                
                     List<Events> eventcountlist = eventcountmonth.getResultList();
           
                if (eventcountlist.size()<= 9) {
                          
                     int ind = thumbframe.indexOf(picturelist);
                     //set the active thumbnail image for refercing in the jsf
                     activethumb = thumbframe.get(ind);
                     
                     if (ind > -1) { 
                          
                          newevent = new Events();
                          
                          log.info("past new object");
                          newevent.setEventuserid(identity.getUsername());
                          newevent.setEventtimelineid(tlid);
                          newevent.setEventname("Event: " + Integer.toString((eventcountlist.size() + 1)));
      
      
      ......... sets more values...... doesnt persist yet
      
      
           public void saveEvent(){
      ///388 breaks here
                newevent.setEventname("somename");
                   newevent.setEventdescript("this.eventdescript");
                entityManager.persist(newevent);
                
                }
      


      the process is started from a drag drop event. it instantiates the entity Events events and set parameters. All executes good.


      some JSF sippets


       <rich:dropSupport dropValue="#{yearvar.year}_#{yearvar.month}"
                          dropListener="#{timelineAction.processDrop}" 
                          acceptedTypes="pic"
                          reRender="eventcontainer"
                          oncomplete="Richfaces.showModalPanel('eventmp');">
      
      .......
      
      
      
      <rich:modalPanel  id="eventmp" minHeight="500" 
                                    minWidth="450" top="20" style="padding:0px;"
                                    onhide="rerenderImageTable();">
                 
              <div style="position:absolute;top:25px;left:25px;">
        <div style="padding:25px;">
        <a:outputPanel id="eventcontainer">
             <h:graphicImage id="previewphoto"
                   value="http://#{timelineAction.activethumb.media.server}/#{timelineAction.activethumb.media.url}/#{timelineAction.activethumb.media.medianame}" 
                   alt="Imagefileupload" style="z-index:250;"
                   rendered="#{not empty activethumb}" />     
        
        <h:form>
      <s:decorate id="eventnameDecoration" template="../layout/edit.xhtml">
                <ui:define name="label">Event Name:</ui:define>
                 <h:inputText value="#{timelineAction.eventname}" 
                                   style="padding:2px;padding-left:4px;" required="true"/>
           </s:decorate>
           <s:decorate id="eventdescriptDecoration" template="../layout/edit.xhtml">
                      <ui:define name="label">Event Details</ui:define>
                      <h:inputTextarea id="eventdescript"
                                     cols="80"
                                     rows="3"
                                    value="#{timelineAction.eventdescript}"/>
          </s:decorate>
                <a:commandButton style="top:200px;" actionListener="#{timelineAction.saveEvent}" value="Save Event"/>     
           </h:form>
      




      no matter how i arrange this.. i get a NPE when the saveEvent is called. as you can see at this point i really wasnt even testing the form.. just passing String values to the entity object in the session bean.


      Caused by: java.lang.NullPointerException
              at com.dcg.action.timeline.TimelineAction.saveEvent(TimelineAction.java:388)
              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.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
              at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      



      when i use debug,, i see the newpic object sitting out there with all my data in it...


      Whats happening to me here??


      could this possibly have something to do with these richfaces functions? calling from the mod panel or something.. i know you could do instantiate in one method and persist in another while in Conversation context in seam 1.2.1. the working example of this has been deployed for almost a year now.


      IS THERE A WORKAROUND I CAN TRY?

        • 1. Re: NPE With Simple Persist
          Nicklas Karlsson Master

          Show the full stack trace. Is it the entitymanager that is not injected?

          • 2. Re: NPE With Simple Persist
            nathan dennis Expert

            thanks for the response...
            unfortunately it is,,, im already using several other places in the class.


            Is event or events a key word.. possibly getting on top of something?



            3:41:28,453 DEBUG [Component] done initializing: org.jboss.seam.core.events
            03:41:28,453 DEBUG [Events] Processing event:org.jboss.seam.postRemoveVariable.timelineAction
            03:41:28,453 DEBUG [RemoveInterceptor] Stateful component was removed: timelineAction
            03:41:28,453 WARN  [lifecycle] /timeline/include/event.xhtml @52,104 actionListener="#{timelineAction.saveEvent}": javax.ejb.EJBTransactionRolledbackException
            javax.faces.el.EvaluationException: /timeline/include/event.xhtml @52,104 actionListener="#{timelineAction.saveEvent}": javax.ejb.EJBTransactionRolledbackException
                    at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
                    at javax.faces.component.UICommand.broadcast(UICommand.java:376)
                    at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:62)
                    at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
                    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
                    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
                    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
                    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                    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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at com.dcg.action.MonitoredMultipartFilter.doFilter(MonitoredMultipartFilter.java:47)
                    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:141)
                    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                    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.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:595)
            Caused by: javax.ejb.EJBTransactionRolledbackException
                    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                    at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                    at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
                    at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
                    at $Proxy136.saveEvent(Unknown Source)
                    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:21)
                    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                    at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                    at org.javassist.tmp.java.lang.Object_$$_javassist_17.saveEvent(Object_$$_javassist_17.java)
                    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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                    at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:45)
                    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                    at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                    ... 47 more
            Caused by: java.lang.NullPointerException
                    at com.dcg.action.timeline.TimelineAction.saveEvent(TimelineAction.java:388)
                    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.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                    at sun.reflect.GeneratedMethodAccessor313.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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                    ... 88 more
            03:41:28,458 WARN  [lifecycle] executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@1e38d900) threw exception
            javax.faces.FacesException: /timeline/include/event.xhtml @52,104 actionListener="#{timelineAction.saveEvent}": javax.ejb.EJBTransactionRolledbackException
                    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
                    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                    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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                    at com.dcg.action.MonitoredMultipartFilter.doFilter(MonitoredMultipartFilter.java:47)
                    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:141)
                    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                    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.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:595)
            Caused by: javax.faces.el.EvaluationException: /timeline/include/event.xhtml @52,104 actionListener="#{timelineAction.saveEvent}": javax.ejb.EJBTransactionRolledbackException
                    at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
                    at javax.faces.component.UICommand.broadcast(UICommand.java:376)
                    at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:62)
                    at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
                    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
                    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
                    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
                    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                    ... 40 more
            Caused by: javax.ejb.EJBTransactionRolledbackException
                    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                    at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                    at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
                    at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
                    at $Proxy136.saveEvent(Unknown Source)
                    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:21)
                    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                    at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                    at org.javassist.tmp.java.lang.Object_$$_javassist_17.saveEvent(Object_$$_javassist_17.java)
                    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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
                    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
                    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
                    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                    at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:45)
                    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                    at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                    ... 47 more
            Caused by: java.lang.NullPointerException
                    at com.dcg.action.timeline.TimelineAction.saveEvent(TimelineAction.java:388)
                    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.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
                    at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                    at sun.reflect.GeneratedMethodAccessor313.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.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                    at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                    ... 88 more
            03:41:28,463 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.events
            03:41:28,463 DEBUG [Component] initializing new instance of: org.jboss.seam.core.events
            03:41:28,463 DEBUG [Component] done initializing: org.jboss.seam.core.events
            03:41:28,463 DEBUG [Events] Processing event:org.jboss.seam.afterPhase
            03:41:28,463 DEBUG [Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
            03:41:28,464 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.locale
            03:41:28,464 DEBUG [Component] initializing new instance of: org.jboss.seam.core.locale
            03:41:28,464 DEBUG [Component] done initializing: org.jboss.seam.core.locale
            03:41:28,464 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.resourceLoader
            03:41:28,464 DEBUG [Component] initializing new instance of: org.jboss.seam.core.resourceLoader
            03:41:28,464 DEBUG [Component] done initializing: org.jboss.seam.core.resourceLoader
            03:41:28,464 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.locale
            03:41:28,464 DEBUG [Component] initializing new instance of: org.jboss.seam.core.locale
            03:41:28,464 DEBUG [Component] done initializing: org.jboss.seam.core.locale
            03:41:28,465 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Component] initializing new instance of: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Component] done initializing: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Component] initializing new instance of: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Component] done initializing: org.jboss.seam.core.interpolator
            03:41:28,465 DEBUG [Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
            03:41:28,465 DEBUG [Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
            03:41:28,465 DEBUG [SeamPhaseListener] rolling back transaction after phase: INVOKE_APPLICATION 5
            03:41:28,465 DEBUG [Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
            03:41:28,466 DEBUG [UTTransaction] rolling back JTA transaction
            03:41:28,466 DEBUG [ManagedEntityManagerFactory] ************** closing entity managersession **************
            03:41:28,466 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.events
            03:41:28,466 DEBUG [Component] initializing new instance of: org.jboss.seam.core.events
            03:41:28,466 DEBUG [Component] done initializing: org.jboss.seam.core.events
            03:41:28,466 DEBUG [Component] instantiating Seam component: org.jboss.seam.core.events
            

            • 3. Re: NPE With Simple Persist
              Nicklas Karlsson Master

              Which line exactly is 388?

              • 4. Re: NPE With Simple Persist
                nathan dennis Expert

                it is marked in the above code.. but i got it off by one line


                387 public void saveEvent(){
                388           newevent.setEventname("somename");
                389             newevent.setEventdescript("this.eventdescript");
                390          entityManager.persist(newevent);
                          
                          }
                



                it is not going back to the previously instantiated object for some reason.
                there is only one copy of timeline Action and obviously one copy of newevent. but it is as if it is looking for another one that doesnt exist.

                • 5. Re: NPE With Simple Persist
                  nathan dennis Expert

                  4 days later i have solved this one.


                  it is the combination of richfaces ajax calls... possibly from using


                     <h:panelGroup id="eventwizard">
                          <a:include  viewId="include/event.xhtml" />
                     </h:panelGroup>
                  
                  



                  modal panel


                  to include the modalPanel in the main xhtml.
                  the problem is exactly what i said in the above post.. it is looking for a bean that doesnt exist in the ajax submit. because the pageation never change, it isnt readily visible,, because the session id doesnt change on the main page. when the session id isnt specified,, it looks like it just gets a new one.  which is a big problem considering  i wanted data from the previous session.. the question is why is it losing it? i have a feeling i should be in the richfaces form to ask this question... but since i lost 4 days,, messing with it.. im going to wait until im not as press to fully understand the problem i just encountered. (this way i get the joy of experiencing it more than once.... sarcasm)


                  very simple to fix once we get our brain around it...


                            <a:commandButton style="top:200px;" actionListener="#{timelineAction.saveEvent}" value="Save Event">
                                 <s:conversationId/>
                            </a:commandButton>     
                  



                  and the problem magically goes to /dev/null


                  thanks for the help. it encourage me to think.