Announcement Announcement Module
Collapse
No announcement yet.
FlowExecutionStorage in a DB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlowExecutionStorage in a DB

    Hi All

    I´ve the need to put my application in various servers with a loadBalancer.

    As I don´t want to have replication of sessions I thouhgt to make my own FlowExecutionStorage class to store flow execution in a DB.

    My code was:

    Code:
    public FlowExecution load(String id, Event event) {
            FlowExecution flow = null;
            Statement stmt;
            ResultSet rs;
    
            if (con == null) {
                con = this.getConnection();
            }
    
            log.info("En load flow");
    
            try {
                stmt = con.createStatement();
                rs = stmt.executeQuery("SELECT flowObject FROM flow WHERE id = '" + id + "'");
    
                while (rs.next()) {
    
                    byte[] st = (byte[]) rs.getObject(1);
                    //   or  byte[] st = rs.getBytes(1);
                    //   or  Blob aBlob = rs.getBlob(1);
                    //       byte[] st = aBlob.getBytes(0, (int) aBlob.length());
                    ByteArrayInputStream baip = new ByteArrayInputStream(st);
                    ObjectInputStream ois = new ObjectInputStream(baip);
                    // re-create the object
                    flow = (FlowExecution) ois.readObject();
    
                    if (log.isInfoEnabled()) {
                        log.info("Retrieving flow ID: " + flow.toString());
                    }
                }
            } catch (ClassNotFoundException cnf) {
                log.error("Error IOE al recuperar flow id: " + id + " con eventId = " + event.getId()
                        + " -- " + cnf.getMessage());
                throw new FlowExecutionStorageException(cnf.getMessage(), cnf);
            } catch (IOException ioe) {
                log.error("Error IOE al recuperar flow id: " + id + " con eventId = " + event.getId()
                        + " -- " + ioe.getMessage());
                throw new FlowExecutionStorageException(ioe.getMessage(), ioe);
            } catch (SQLException sqle) {
                log.error("Error al recuperar flow id " + id
                        + " con eventId = " + event.getId() + " table: " + sqle.getMessage());
                throw new FlowExecutionStorageException(sqle.getMessage(), sqle);
            }
    
            return flow;
        }
    
        public void remove(String id, Event event) {
            boolean result = false;
    
            log.info("En remove flow");
    
            try {
                Statement stmt = con.createStatement();
                result = stmt.execute("DELETE FROM flow WHERE id = '" + id + "'");
    
            } catch (SQLException sqle) {
                log.error("Error SQL al borrar flow id " + id
                        + " y eventId = " + event.getId()
                        + " exception: " + sqle.getMessage());
            }
    
            log.info("Al borrar flow con id = " + id
                    + " y eventId = " + event.getId() + "resultado fue: " + result);
        }
    
        /**
         * Saves a flow execution session
         *
         * @param id
         * @param flowExecution
         * @param event
         * @return id
         */
        public String save(String id,
                           FlowExecution flowExecution,
                           Event event) {
    
            if (con == null) {
                con = this.getConnection();
            }
    
            if (id == null) {
                DefaultRandomStringGenerator drg = new DefaultRandomStringGenerator(40);
                id = drg.getNewString();
            }
    
            log.info("Event es: " + event.toString());
    
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                ObjectOutputStream oos = new ObjectOutputStream(baos);
                oos.writeObject(flowExecution);
                // serialize the employee object into a byte array
                byte[] flowAsBytes = baos.toByteArray();
                ByteArrayInputStream bais =
                        new ByteArrayInputStream(flowAsBytes);
    
                // Insert into DB
                PreparedStatement pstmt = con.prepareStatement("INSERT INTO flow VALUES(?, ?, ?)");
                pstmt.setString(1, id);
                pstmt.setBinaryStream(2, bais, flowAsBytes.length);
                pstmt.setString(3, event.getId());
                pstmt.executeUpdate();
                pstmt.close();
    
                log.info("Inserted in DB id = " + id
                        + " and flowExecutin = " + flowExecution.toString()
                        + " and event = " + event.getId());
    
            } catch (IOException ioe) {
                log.error("Error IOE al insertar en flow table: " + ioe.getMessage());
                throw new FlowExecutionStorageException(ioe.getMessage(), ioe);
            } catch (SQLException sqle) {
                log.error("Error al insertar en flow table: " + sqle.getMessage());
                throw new FlowExecutionStorageException(sqle.getMessage(), sqle);
            }
    
            return id;
        }

    My application uses a login flow then when starts it shows a login page form and I can see in DB that stores data ok.

    But when I make the submit, my app hangs and I see the followin error:

    Code:
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Request submited>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Execution listener...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Session starting>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Execution listener...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Session started...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <State entered...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Execution listener...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.TicketGrantingTicketCheckAction&#93; - <Entre en TGTCheckAction>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.TicketGrantingTicketCheckAction&#93; - <EN TGTCheckAction appId es&#58; null>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.TicketGrantingTicketCheckAction&#93; - <No hay ST ni TGT hay renew>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.TicketGrantingTicketCheckAction&#93; - <Service es null>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Session started...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <State entered...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Execution listener...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Session started...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.BSFlowListenerImpl&#93; - <Session started...>
    2005-10-03 15&#58;15&#58;09,788 INFO &#91;com.bs.its.tp.cas.web.flow.DBFlowExecutionStorage&#93; - <Event es&#58; &#91;ServletEvent@10e9df source = org.apache.coyote.tomcat5.CoyoteRequestFacade@6a2f81, id = &#91;null&#93;, stateId = &#91;null&#93;, parameters = map&#91;&#91;empty&#93;&#93;&#93;>
    2005-10-03 15&#58;15&#58;09,803 INFO &#91;com.bs.its.tp.cas.web.flow.DBFlowExecutionStorage&#93; - <Inserted in DB id = f5MurWyM4p3qQzceJzBjIiGVcxaOcw2OGGFjoweo and flowExecutin = &#91;FlowExecutionImpl@154ea79 activeFlowId = 'logonFlow', currentStateId = 'viewLogonForm', rootFlow = &#91;Flow@1e2c841 id = 'logonFlow', startState = &#91;ActionState@205756 id = 'ticketGrantingTicketCheck', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@3299f6 action = [email protected], properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@996cca on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@b57e9a on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@18adae2 on = 'bindAndValidate', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1283052 on = 'gateway', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@17c96a9 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, states = set&#91;&#91;ActionState@205756 id = 'ticketGrantingTicketCheck', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@3299f6 action = [email protected], properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@996cca on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@b57e9a on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@18adae2 on = 'bindAndValidate', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1283052 on = 'gateway', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@17c96a9 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@873723 id = 'authorize', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@1533c8 action = com.bs.its.tp.cas.web.flow.AuthorizeAction@1faa614, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@16ef705 on = 'warn', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1b7c76 on = 'validated', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@883357 on = 'errorXml', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1e2afb2 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ViewState@17cfd38 id = 'viewLogonForm', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@ffc3eb, setupCriteria = &#91;null&#93;, setupErrorStateId = &#91;null&#93;, transitions = set&#91;&#91;Transition@15b8520 on = 'submit', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@18105e8 id = 'bindAndValidate', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@1978933 action = com.bs.its.tp.cas.web.flow.LoginFormAction@1b0889a, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@1250ff2 on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@3a0ab1 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@940f82 id = 'submit', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@d844a9 action = com.bs.its.tp.cas.web.flow.LoginFormAction@1b0889a, properties = map&#91;'method' -> 'submit'&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@17c2891 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@4b82d2 on = 'authorize', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@179d854 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@69a4cb on = 'ticketException', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@1c20eb7 id = 'warn', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@185fe0c action = com.bs.its.tp.cas.web.flow.WarnAction@1e9f5cc, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@b86944 on = 'redirect', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@107108e on = 'warn', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;EndState@cfe049 id = 'viewGenericLogon', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@831a91&#93;, &#91;EndState@18e18a3 id = 'showWarningView', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@1453d72&#93;, &#91;EndState@1f38fc6 id = 'redirect', flow = 'logonFlow', viewDescriptorProducer = org.jasig.cas.web.flow.RedirectViewDescriptorCreator@1c70315&#93;, &#91;EndState@179f36b id = 'viewNoAuthorized', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@9b59a2&#93;, &#91;EndState@15bfdbd id = 'viewNotAuthorizedXML', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@119db9e&#93;, &#91;EndState@6f8b2b id = 'viewValidated', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@a166bd&#93;&#93;&#93;, executingFlowSessions = list&#91;&#91;FlowSessionImpl@17d2f0e flow = &#91;Flow@1e2c841 id = 'logonFlow', startState = &#91;ActionState@205756 id = 'ticketGrantingTicketCheck', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@3299f6 action = com.bs.its.tp.cas.web.flow.TicketGrantingTicketCheckAction@19fc25, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@996cca on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@b57e9a on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@18adae2 on = 'bindAndValidate', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1283052 on = 'gateway', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@17c96a9 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, states = set&#91;&#91;ActionState@205756 id = 'ticketGrantingTicketCheck', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@3299f6 action = [email protected], properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@996cca on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@b57e9a on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@18adae2 on = 'bindAndValidate', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1283052 on = 'gateway', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@17c96a9 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@873723 id = 'authorize', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@1533c8 action = com.bs.its.tp.cas.web.flow.AuthorizeAction@1faa614, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@16ef705 on = 'warn', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1b7c76 on = 'validated', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@883357 on = 'errorXml', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@1e2afb2 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ViewState@17cfd38 id = 'viewLogonForm', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@ffc3eb, setupCriteria = &#91;null&#93;, setupErrorStateId = &#91;null&#93;, transitions = set&#91;&#91;Transition@15b8520 on = 'submit', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@18105e8 id = 'bindAndValidate', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@1978933 action = com.bs.its.tp.cas.web.flow.LoginFormAction@1b0889a, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@1250ff2 on = 'success', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@3a0ab1 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@940f82 id = 'submit', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@d844a9 action = com.bs.its.tp.cas.web.flow.LoginFormAction@1b0889a, properties = map&#91;'method' -> 'submit'&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@17c2891 on = 'noService', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@4b82d2 on = 'authorize', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@179d854 on = 'error', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@69a4cb on = 'ticketException', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;ActionState@1c20eb7 id = 'warn', flow = 'logonFlow', actions = set&#91;&#91;AnnotatedAction@185fe0c action = com.bs.its.tp.cas.web.flow.WarnAction@1e9f5cc, properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;, transitions = set&#91;&#91;Transition@b86944 on = 'redirect', properties = map&#91;&#91;empty&#93;&#93;&#93;, &#91;Transition@107108e on = 'warn', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, &#91;EndState@cfe049 id = 'viewGenericLogon', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@831a91&#93;, &#91;EndState@18e18a3 id = 'showWarningView', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@1453d72&#93;, &#91;EndState@1f38fc6 id = 'redirect', flow = 'logonFlow', viewDescriptorProducer = org.jasig.cas.web.flow.RedirectViewDescriptorCreator@1c70315&#93;, &#91;EndState@179f36b id = 'viewNoAuthorized', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@9b59a2&#93;, &#91;EndState@15bfdbd id = 'viewNotAuthorizedXML', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@119db9e&#93;, &#91;EndState@6f8b2b id = 'viewValidated', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@a166bd&#93;&#93;&#93;, currentState = &#91;ViewState@17cfd38 id = 'viewLogonForm', flow = 'logonFlow', viewDescriptorProducer = org.springframework.web.flow.SimpleViewDescriptorCreator@ffc3eb, setupCriteria = &#91;null&#93;, setupErrorStateId = &#91;null&#93;, transitions = set&#91;&#91;Transition@15b8520 on = 'submit', properties = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93;, attributesCount = 0, attributes = map&#91;&#91;empty&#93;&#93;&#93;&#93;&#93; and event = null>
    2005-10-03 15&#58;15&#58;38,647 ERROR &#91;org.springframework.web.servlet.DispatcherServlet&#93; - <Could not complete request>
    java.lang.NullPointerException
    	at org.springframework.web.flow.execution.impl.FlowExecutionImpl.toString&#40;FlowExecutionImpl.java&#58;483&#41;
    	at com.bs.its.tp.cas.web.flow.DBFlowExecutionStorage.load&#40;DBFlowExecutionStorage.java&#58;57&#41;
    	at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;272&#41;
    	at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;245&#41;
    	at org.springframework.web.flow.execution.servlet.ServletFlowExecutionManager.handle&#40;ServletFlowExecutionManager.java&#58;77&#41;
    	at org.springframework.web.flow.mvc.FlowController.handleRequestInternal&#40;FlowController.java&#58;137&#41;
    	at org.springframework.web.servlet.mvc.AbstractController.handleRequest&#40;AbstractController.java&#58;128&#41;
    	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle&#40;SimpleControllerHandlerAdapter.java&#58;44&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;684&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;625&#41;
    	at org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;386&#41;
    	at org.springframework.web.servlet.FrameworkServlet.doPost&#40;FrameworkServlet.java&#58;355&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;709&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;802&#41;
    	at org.jasig.cas.web.init.SafeDispatcherServlet.service&#40;SafeDispatcherServlet.java&#58;115&#41;
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;237&#41;
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;157&#41;
    	at org.apache.catalina.core.StandardWrapperValve.invoke&#40;StandardWrapperValve.java&#58;214&#41;
    	at org.apache.catalina.core.StandardValveContext.invokeNext&#40;StandardValveContext.java&#58;104&#41;
    	at org.apache.catalina.core.StandardPipeline.invoke&#40;StandardPipeline.java&#58;520&#41;
    	at org.apache.catalina.core.StandardContextValve.invokeInternal&#40;StandardContextValve.java&#58;198&#41;
    	at org.apache.catalina.core.StandardContextValve.invoke&#40;StandardContextValve.java&#58;152&#41;
    	at org.apache.catalina.core.StandardValveContext.invokeNext&#40;StandardValveContext.java&#58;104&#41;
    	at org.apache.catalina.core.StandardPipeline.invoke&#40;StandardPipeline.java&#58;520&#41;
    	at org.apache.catalina.core.StandardHostValve.invoke&#40;StandardHostValve.java&#58;137&#41;
    	at org.apache.catalina.core.StandardValveContext.invokeNext&#40;StandardValveContext.java&#58;104&#41;
    	at org.apache.catalina.valves.ErrorReportValve.invoke&#40;ErrorReportValve.java&#58;118&#41;
    	at org.apache.catalina.core.StandardValveContext.invokeNext&#40;StandardValveContext.java&#58;102&#41;
    	at org.apache.catalina.core.StandardPipeline.invoke&#40;StandardPipeline.java&#58;520&#41;
    	at org.apache.catalina.core.StandardEngineValve.invoke&#40;StandardEngineValve.java&#58;109&#41;
    	at org.apache.catalina.core.StandardValveContext.invokeNext&#40;StandardValveContext.java&#58;104&#41;
    	at org.apache.catalina.core.StandardPipeline.invoke&#40;StandardPipeline.java&#58;520&#41;
    	at org.apache.catalina.core.ContainerBase.invoke&#40;ContainerBase.java&#58;929&#41;
    	at org.apache.coyote.tomcat5.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;160&#41;
    	at org.apache.coyote.http11.Http11Processor.process&#40;Http11Processor.java&#58;799&#41;
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection&#40;Http11Protocol.java&#58;705&#41;
    	at org.apache.tomcat.util.net.TcpWorkerThread.runIt&#40;PoolTcpEndpoint.java&#58;577&#41;
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run&#40;ThreadPool.java&#58;683&#41;
    	at java.lang.Thread.run&#40;Thread.java&#58;534&#41;
    03-oct-2005 15&#58;21&#58;44 org.apache.coyote.http11.Http11Protocol pause
    I really don't know why the error is produced.

    Also, I saw that event parameter comes to save method always without data and is never used to return a vale. Why all methods receives an event parameter ?

    Could someboyd give me a clue about this ?


    Thanks in advance

    J

  • #2
    Seems like you're not using SWF PR5 since the package names mentioned in the trace are still "org.springframework.web.flow.*". First upgrade to PR5 and try again!

    Why all methods receives an event parameter ?
    The event parameter coming into all the methods of the FlowExecutionStorage interface give the flow execution storage implementation access to the source event of the request, and as such to things like the HTTP request. This is needed for instance to store flow executions in the HTTP session. Check the source code of HttpSessionFlowExecutionStorage for an example.

    Erwin

    Comment


    • #3
      Originally posted by klr8
      Seems like you're not using SWF PR5 since the package names mentioned in the trace are still "org.springframework.web.flow.*". First upgrade to PR5 and try again!

      Why all methods receives an event parameter ?
      The event parameter coming into all the methods of the FlowExecutionStorage interface give the flow execution storage implementation access to the source event of the request, and as such to things like the HTTP request. This is needed for instance to store flow executions in the HTTP session. Check the source code of HttpSessionFlowExecutionStorage for an example.

      Erwin

      Thanks for your reply.

      Desafortunately, I can´t upgrade easily because I'm using CAS and it depends of web-flow pr3. I´ve tried to upgrade but I got a lot of exceptions.

      Nevertheless, I´ve found the error of my app. It´s produced when I retrieve the stored FlowExecution object from DB.

      I´m doing:



      Code:
      stmt = con.createStatement&#40;&#41;;
                  rs = stmt.executeQuery&#40;"SELECT flowObject FROM flow WHERE id = '" + id + "'"&#41;;
      
                  while &#40;rs.next&#40;&#41;&#41; &#123;
      
                      log.info&#40;"Entre en while"&#41;;
      
                      byte&#91;&#93; st = &#40;byte&#91;&#93;&#41; rs.getObject&#40;1&#41;;
                      //   or  byte&#91;&#93; st = rs.getBytes&#40;1&#41;;
                      //   or  Blob aBlob = rs.getBlob&#40;1&#41;;
                      //       byte&#91;&#93; st = aBlob.getBytes&#40;0, &#40;int&#41; aBlob.length&#40;&#41;&#41;;
                      ByteArrayInputStream baip =
                              new ByteArrayInputStream&#40;st&#41;;
                      log.info&#40;"ByteArray es&#58; " + baip.toString&#40;&#41;&#41;;
      
                      ObjectInputStream ois =
                              new ObjectInputStream&#40;baip&#41;;
                      log.info&#40;"ois class es&#58; " + ois.getClass&#40;&#41;.getName&#40;&#41;&#41;;
                      log.info&#40;"ObjectInputStream is&#58; " + ois.toString&#40;&#41;&#41;;
      
                      // re-create the object
                      flow = &#40;FlowExecution&#41; ois.readObject&#40;&#41;;
      
                      log.info&#40;"Flow recuperado es&#58; " + flow.toString&#40;&#41;&#41;;
      
                      if &#40;log.isInfoEnabled&#40;&#41;&#41; &#123;
                          log.info&#40;"Retrieving flow ID&#58; " + flow.toString&#40;&#41;&#41;;
                      &#125;
                  &#125;
      and I can see logf lines till ois.readObject line where I get a NullPointer exception.

      How is supposed should I store and retrieve FlowExecutionObjects from my DB ?

      Thanks in advance

      C

      Comment


      • #4
        I'm not sure. It could well be that there is a NPE bug in the PR3 release with the custom serialization code in FlowExecutionImpl. That's why I asked you to upgrade to PR5.

        Erwin

        Comment


        • #5
          Originally posted by klr8
          I'm not sure. It could well be that there is a NPE bug in the PR3 release with the custom serialization code in FlowExecutionImpl. That's why I asked you to upgrade to PR5.

          Erwin
          Hi

          Well, I´ve upgraded to the new version after a lot of changes (I´ve been thinking all the time in the man/girl that changed package names, jeje) but the error is still present.

          I´ve made a debug with IDEA an discovered something that may be a webflow bug:

          (below is the analysis of the object I retrieved from a DB)

          Code:
          flow = &#123;org.springframework.webflow.execution.FlowExecutionImpl@680&#125;Method threw 'java.lang.NullPointerException' exception. Failed to evaluate toString&#40;&#41; for this object
          key&#58; java.lang.String = &#123;java.lang.String@699&#125;"B5FF815F-1576-F5AA-E6B9-85BC6AC60E50"
          creationTimestamp&#58; long = 1128502758991
          rootFlow&#58; org.springframework.webflow.Flow = null
          rootFlowId&#58; java.lang.String = &#123;java.lang.String@700&#125;"logonFlow"
          value&#58; char&#91;&#93; = &#123;char&#91;16&#93;@704&#125;
          offset&#58; int = 0
          count&#58; int = 9
          hash&#58; int = 0
          lastEventId&#58; java.lang.String = &#123;java.lang.String@701&#125;"error"
          value&#58; char&#91;&#93; = &#123;char&#91;16&#93;@705&#125;
          &#91;0&#93; = 'e' 101
          &#91;1&#93; = 'r' 114
          &#91;2&#93; = 'r' 114
          &#91;3&#93; = 'o' 111
          &#91;4&#93; = 'r' 114
          &#91;5&#93; = '\u0000' 0
          &#91;6&#93; = '\u0000' 0
          &#91;7&#93; = '\u0000' 0
          &#91;8&#93; = '\u0000' 0
          &#91;9&#93; = '\u0000' 0
          &#91;10&#93; = '\u0000' 0
          &#91;11&#93; = '\u0000' 0
          &#91;12&#93; = '\u0000' 0
          &#91;13&#93; = '\u0000' 0
          &#91;14&#93; = '\u0000' 0
          &#91;15&#93; = '\u0000' 0
          offset&#58; int = 0
          count&#58; int = 5
          hash&#58; int = 0
          lastRequestTimestamp&#58; long = 1128502758991
          executingFlowSessions&#58; java.util.Stack = &#123;java.util.Stack@702&#125; size = 1
          &#91;0&#93; = &#123;org.springframework.webflow.execution.FlowSessionImpl@707&#125;Method threw 'java.lang.NullPointerException' exception. Failed to evaluate toString&#40;&#41; for this object
          flow&#58; org.springframework.webflow.Flow = null
          flowId&#58; java.lang.String = &#123;java.lang.String@700&#125;"logonFlow"
          value&#58; char&#91;&#93; = &#123;char&#91;16&#93;@704&#125;
          &#91;0&#93; = 'l' 108
          &#91;1&#93; = 'o' 111
          &#91;2&#93; = 'g' 103
          &#91;3&#93; = 'o' 111
          &#91;4&#93; = 'n' 110
          &#91;5&#93; = 'F' 70
          &#91;6&#93; = 'l' 108
          &#91;7&#93; = 'o' 111
          &#91;8&#93; = 'w' 119
          &#91;9&#93; = '\u0000' 0
          &#91;10&#93; = '\u0000' 0
          &#91;11&#93; = '\u0000' 0
          &#91;12&#93; = '\u0000' 0
          &#91;13&#93; = '\u0000' 0
          &#91;14&#93; = '\u0000' 0
          &#91;15&#93; = '\u0000' 0
          offset&#58; int = 0
          count&#58; int = 9
          hash&#58; int = 0
          currentState&#58; org.springframework.webflow.State = null
          currentStateId&#58; java.lang.String = &#123;java.lang.String@711&#125;"viewLogonForm"
          value&#58; char&#91;&#93; = &#123;char&#91;16&#93;@722&#125;
          &#91;0&#93; = 'v' 118
          &#91;1&#93; = 'i' 105
          &#91;2&#93; = 'e' 101
          &#91;3&#93; = 'w' 119
          &#91;4&#93; = 'L' 76
          &#91;5&#93; = 'o' 111
          &#91;6&#93; = 'g' 103
          &#91;7&#93; = 'o' 111
          &#91;8&#93; = 'n' 110
          &#91;9&#93; = 'F' 70
          &#91;10&#93; = 'o' 111
          &#91;11&#93; = 'r' 114
          &#91;12&#93; = 'm' 109
          &#91;13&#93; = '\u0000' 0
          &#91;14&#93; = '\u0000' 0
          &#91;15&#93; = '\u0000' 0
          offset&#58; int = 0
          count&#58; int = 13
          hash&#58; int = 0
          status&#58; org.springframework.webflow.FlowSessionStatus = &#123;org.springframework.webflow.FlowSessionStatus@712&#125;"&#91;class org.springframework.webflow.FlowSessionStatus.Paused &#40;2&#41;&#93;"
          code&#58; java.lang.Short = &#123;java.lang.Short@717&#125;"2"
          value&#58; short = 2
          label&#58; java.lang.String = &#123;java.lang.String@718&#125;"Paused"
          value&#58; char&#91;&#93; = &#123;char&#91;16&#93;@723&#125;
          offset&#58; int = 0
          count&#58; int = 6
          hash&#58; int = 0
          flowScope&#58; org.springframework.webflow.Scope = &#123;org.springframework.webflow.Scope@713&#125; size = 0
          parent&#58; org.springframework.webflow.execution.FlowSessionImpl = null
          listenerList&#58; org.springframework.webflow.execution.FlowExecutionListenerList = null
          transactionSynchronizer&#58; org.springframework.webflow.execution.TransactionSynchronizer = null
          If you see above lines, the FlowExecution object is retrieved ok from DB but there is a lien saying

          org.springframework.webflow.execution.FlowSessionI mpl@707}Method threw 'java.lang.NullPointerException' exception. Failed to evaluate toString() for this object

          Is this really a webflow bug ?

          Thanks in advance

          C

          Comment


          • #6
            Yes, I already noticed in your original post that a toString call seemed to cause the NPE:

            2005-10-03 15:15:38,647 ERROR [org.springframework.web.servlet.DispatcherServlet] - <Could not complete request>
            java.lang.NullPointerException
            at org.springframework.web.flow.execution.impl.FlowEx ecutionImpl.toString(FlowExecutionImpl.java:483)
            at com.bs.its.tp.cas.web.flow.DBFlowExecutionStorage. load(DBFlowExecutionStorage.java:57)
            Could your DBFlowExecutionStorage object be calling toString() on the loaded flowExecution before it is fully restored? Note that the FlowExecutionManager will call rehydrate() on the loaded flowExecution to 'revive' it. It's only after that call that the flowExecution is fully reloaded and ready to 'do' something, e.g. handle toString().

            Erwin

            Comment


            • #7
              clustering CAS

              I am very interested in this thread. What is the structure of the table used? What datatype have you used to store a FlowExecution?

              Comment


              • #8
                I am also having some issues since we are contacting external system in loadbalnaced env..... can i get the correct source code please...

                Comment

                Working...
                X