0 Replies Latest reply on Jan 17, 2013 8:33 AM by wilczarz

    s:fileUpload ends conversation in Seam2

    wilczarz

      Hi guys,

       

      It's been a while since I last posted, but I really need your help with a Seam2 / JSF app I created a few years back.

       

      I have a long running conversation, in which I let user upload Excel file. Occasionaly users experience  "Conversation ended timed out processing another request" after submitting the form. This error is very vague, sometimes restarting the conversation does the trick, and sometimes it crashes a dozen times in a row. Personally I have never managed to get this error on my machine (or any other whatsoever) which might suggest that the problem is platform/broadband specific. I know for a fact that it happens on both IE and Firefox, in most cases on MS Vista.

       

      I found a few topics covering this error, some suggesting that increasing concurrent-request-timeout might help, but it didn't. It is very hard to fight this error since I cannot reproduce it. Can anyone point me in the right direction?

       

      My LRC is backed by Seam pageflow, with the main component being a stateful EJB. I use Richfaces 3.4 with Facelets for rendering the view.

       

      Snippets from components.xml:

       

      {code:xml}<core:manager concurrent-request-timeout="5000"

          conversation-timeout="1200000"

          conversation-id-parameter="cid" />

       

      <component class="org.jboss.seam.web.MultipartFilter">

          <property name="createTempFiles">true</property>

          <property name="maxRequestSize">1000000</property>

      </component>{code}

       

       

      Facelets view:

       

      {code:xml}<h:formid="uploadForm"enctype="multipart/form-data">

        <h:commandButtonid="forward"value="#{messages['forward']}"action="next"styleClass="formButton"/>

        <s:decoratetemplate="layout/edit.xhtml"id="uploadDecorate">

        <s:fileUploaddata="#{reportConverter.reportImported}"accept="application/vnd.ms-excel"size="125"style="width:600px"id="upload"/>

      </h:form>{code}

       

       

      Jpdl definition:

      {code:xml}<page  view-id="/importReport.xhtml"  name="importReport"  no-conversation-view-id="/home.xhtml"  >

      <transition  name="next"  to="validateImportedReport"  >

        <action  expression="#{ratingProcessAction.autoPauseProcess}"  />

      </transition>

      <action  expression="#{ratingProcessAction.rememberRatingStage}"  />

      </page>

       

      <decision  name="validateImportedReport"  expression="#{reportConverter.importReport}"  >

      <transition  name="valid"  to="editAccountEntries">

        <action  expression="#{ratingProcessAction.autoPauseProcess}"  />

      </transition>

      <transition  name="invalid"  to="importReport"  />

      </decision>{code}

       

       

      Component handling the input:

       

      {code:java}@Name( "reportConverter" )

      public class ReportConverter {

          private byte[]                    reportImported;

          ...

          public String importReport() {

              if( reportImported.length == 0 ) {

                  return "valid";

              } else {

                  Workbook workbook = null;

                  try {

                      WorkbookSettings ws = new WorkbookSettings();

                      ws.setCellValidationDisabled( true );

                      ws.setGCDisabled( true );

       

                      workbook = Workbook.getWorkbook( new ByteArrayInputStream( reportImported ), ws );

       

                      ... JExcel API stuff, ommited for clarity...

                  } catch ( BiffException e ) {

                      facesAdapter.addGlobalError( "report.template.upload.wrongFile" );

                      log.error( "Error reading Excel file uploaded by #{identity.username}. Possible error in document.", e );

                      return "invalid";

                  } catch ( IOException e ) {

                      facesAdapter.addGlobalError( "report.template.upload.wrongFile" );

                      log.error( "Error reading file uploaded by #{identity.username}", e );

                      return "invalid";

                  } finally {

                      if( workbook != null ) {

                          workbook.close();

                      }

                  }

                  log.info( "User #{identity.username} successfully imported report from Excel file" );

                  return "valid";

              }

          }{code}