4 Replies Latest reply on Jan 29, 2008 3:38 AM by maksimkaszynski

    3.1.3 GA vs 3.1.3 SNAPSHOT - managed bean trouble (!)

    j-pro

      Good afternoon.

      I've faced a real problem while upgraded to 3.1.3 GA. I've spent a day to analyze it and to find out if it's my fault. But it seems

      that it's not.

      First of all I should say that I have two separate computers with two separate JBoss servers and deployed applications. One using RF

      3.1.3 GA and one using 3.1.3 SNAPSHOT. I've mentioned it just to exclude problems with old cache, etc.

      I'll explain the trouble in general first: I have scrollableDataTable with two employees in it. I should click on employee, then on

      the link "edit" and as a result - new window should be opened with employee data in the edit form. So, for it I do: when I click on

      any of these two employees, a4j:support event onrowclick fires, with a4j:actionparam (it's a workaround because of JIRA RF-1248) as

      employee ID of clicked column, and a method of a managed bean is invoked. This method just fills managed bean Employee data member

      with data, retrieved from the database using actionparam - employee ID. The scope of this managed bean is session, so I can see the

      managed bean's Employee data member from any page(and for sure fill any form from it). Then I click on the link "edit" and new

      window opens with the form for employee edit, where fields of this form are the fields of managed bean Employee data member.

      That's the point. And if to say in general - using SNAPSHOT version, I have all form fields correctly filled in from the managed

      bean Employee data member. But the same application with only difference - GA version of RF, gives me all fields as empty(nulls).

      I've tested it all for a lot of times and have some logs.

      First I'll show the code(because it's identical for two servers), then I'll show the results to show to you, I hope it helps.


      Here is my scrollableDataTable with the link "edit" below it:

      <h:form id="staffDataTable_Form">
       <rich:scrollableDataTable id="staffDataTable" height="400px" rowKeyVar="rkv"
       binding="#{staffSDTableMan.sdTable}" selection="#{staffSDTableMan.scrollableDataTableSelection}"
       onRowMouseOver="this.style.backgroundColor='#B5CEFD'"
       onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
       rowClasses="sdt_row1,sdt_row2" selectedClass="sdt_row_selected" activeClass="sdt_row_active"
       width="500px" rows="0" columnClasses="sdt_col" frozenColCount="1"
       value="#{amBean.employeeListMan.staffEmployees}" var="employee" sortMode="single">
      
       <a4j:support event="onRowClick" onSubmit="this.style.backgroundColor='#000000"
      
      actionListener="#{staffSDTableMan.sdtRowSelected}" reRender="editWorker_panel_output">
       <a4j:actionparam name="tillJanuary08Parameter" value="#{employee.employeeId}" assignTo="#{amBean.parameterID}"/>
       </a4j:support>
      
       <rich:column id="firstName">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="#{muiBundle.sdTableFirstName}" /></f:facet>
       <h:outputText value="#{employee.firstName}" />
       </rich:column>
      
       <rich:column id="lastName">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="#{muiBundle.sdTableLastName}" /></f:facet>
       <h:outputText value="#{employee.lastName}" />
       </rich:column>
      
       <rich:column id="sex">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="#{muiBundle.sdTableSex}" /></f:facet>
       <h:outputText value="#{employee.sex}" />
       </rich:column>
      
       <rich:column id="birthDate">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="#{muiBundle.sdTableBDate}" /></f:facet>
       <h:outputText value="#{employee.birthDate}" />
       </rich:column>
      
       <rich:column id="birthPlace">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="#{muiBundle.sdTableBPlace}" /></f:facet>
       <h:outputText value="#{employee.birthPlace}" />
       </rich:column>
      
       </rich:scrollableDataTable>
      
       <BR style="text-size:3px;"/>
      
       <a4j:commandButton disabled="true" action="#{staffSDTableMan.prepareNewWorker}"
      
      value="#{muiBundle.buttonOrder}"></a4j:commandButton>
       <!-- <a href="javascript:Richfaces.showModalPanel('editWorker_panel',{width:700, top:200})">Edit</a> -->
       <!-- <a href="editpersdata.jsf" target="_blank" class="txtlink">Edit</a> -->
       <h:commandLink id="editStaffLink" value="#{muiBundle.commonEdit}" styleClass="txtlink"
      
      onclick="window.open('/AHRS/editpersdata.jsf','Edit staff')"/>
      
      </h:form>


      Here is the fragment of the editpersdata.xhtml (the page with form where employee should be edited):
      ...
      
      <h:panelGrid columns="6" width="100%">
      
       <h:panelGroup>
       <font color="red">*</font>
       <h:outputText value="#{amBean.tmp}" styleClass="txterror"/>
       <h:outputText value="#{muiBundle.persDataPassDataFirstName}" />
       </h:panelGroup>
      
       <h:panelGroup>
       <h:inputText id="employeeFirstNameEdit" required="true"
       requiredMessage="#{constMan.requiredMessage}"
       value="#{amBean.employee.firstName}"/>
       <rich:message styleClass="rich_error_message" for="employeeFirstNameEdit">
       <f:facet name="passedMarker">
       <h:graphicImage value="images/valid_ok.gif" />
       </f:facet>
       <f:facet name="errorMarker">
       <h:graphicImage value="images/valid_err.gif" />
       </f:facet>
       </rich:message>
       </h:panelGroup>
      
      ...



      "<h:outputText value="#{amBean.tmp}" styleClass="txterror"/>" is added only for logging purposes, for testing current problem only.

      Actually I don't need this text here. I've put in amBean.getTmp() a log string, just to know that next log string will be from

      firstName getter(amBean.employee.getFirstName()). Here is these two methods:

      getTmp() from amBean:
      public String getTmp()
       {
       System.out.println("!!!!!!!!!HERE!!!!!!!!!");
       return "";
       }

      and getFirstName() from Employee entity class:
      public String getFirstName()
       {
       System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: " + this.firstName);
       return this.firstName;
       }




      So, that's the code. But here is the tests:


      1. SNAPSHOT version:

      a) Click on employee in the scrollableDataTable (log shows that staffSDTableMan.sdtRowSelected works perfect and amBean.employee is

      successfully filled with data of currently clicked employee from the DB)
      b) Click on on the "edit" link, new window shows with the PROPERLY filled form and here is the log:
      23:19:04,834 INFO [STDOUT]
      
      =========> Outside Interceptor invoked
      23:19:04,834 INFO [STDOUT] Invoking netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:19:04,912 INFO [STDOUT] !!!!!!!!!HERE!!!!!!!!!
      23:19:04,912 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:19:04,928 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:19:05,006 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:19:05,022 INFO [STDOUT] Exiting netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:19:05,022 INFO [STDOUT] This method takes 188ms to execute
      23:19:05,022 INFO [STDOUT] =========> Outside Interceptor quit
      23:19:05,319 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:19:05,366 INFO [STDOUT] =========> Outside Interceptor invoked
      23:19:05,366 INFO [STDOUT] Invoking netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:19:05,569 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:19:05,616 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:19:05,631 INFO [STDOUT] Exiting netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:19:05,631 INFO [STDOUT] This method takes 265ms to execute
      23:19:05,631 INFO [STDOUT] =========> Outside Interceptor quit
      23:19:05,662 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:19:05,662 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:19:08,037 INFO [STDOUT] !!!!!!!!!HERE!!!!!!!!!
      23:19:08,053 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii



      2. GA version:

      a) Click on employee in the scrollableDataTable (log shows that staffSDTableMan.sdtRowSelected works perfect and amBean.employee is

      successfully filled with data of currently clicked employee from the DB)
      b) Click on on the "edit" link, new window shows with EMPTY form and here is the log:
      23:12:01,758 INFO [STDOUT] =========>
      
      Outside Interceptor invoked
      23:12:01,758 INFO [STDOUT] Invoking netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:12:01,805 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:01,836 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:12:01,883 INFO [STDOUT] Exiting netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:12:01,883 INFO [STDOUT] This method takes 125ms to execute
      23:12:01,883 INFO [STDOUT] =========> Outside Interceptor quit
      23:12:02,039 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:02,039 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:12:02,118 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:02,133 INFO [STDOUT] =========> Outside Interceptor invoked
      23:12:02,133 INFO [STDOUT] Invoking netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:12:02,336 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:02,383 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:12:02,414 INFO [STDOUT] Exiting netinfo.hrdslr.buslogic.EmployeeDAOBean.getAllStaffVisible()
      23:12:02,414 INFO [STDOUT] This method takes 281ms to execute
      23:12:02,414 INFO [STDOUT] =========> Outside Interceptor quit
      23:12:02,477 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:02,477 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:12:02,664 INFO [STDOUT] !!!!!!!!!HERE!!!!!!!!!
      23:12:02,664 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: null
      23:12:06,149 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Dmitrii
      23:12:06,149 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: Ivan
      23:12:06,399 INFO [STDOUT] !!!!!!!!!HERE!!!!!!!!!
      23:12:06,399 INFO [STDOUT] $$$$$$$$$$$$$$$$$$$$$$$$>>>>>>>>>>>>>>>>> getFirstName invoked, it's: null



      Notice 1: It's only STDOUT logs, but I've saved full server logs with a lot of [DEBUG] information (both from server with GA

      and SNAPSHOT versions). The logs are from the moment of app deploy till showing employee edit form. If you need it - I can send it

      to you.

      Notice 2: getAllStaffVisible - it's a method that gets data for scrollable data tabe(there is interceptor for it, that's why

      it out's its logs). By the way - I can't understand why scrollableDataTable renews it's data when I press the "edit" link? I'm sure

      that it refreshes because of getAllStaffVisible is invoked after I press "edit" link...

      Conclusion: The problem is visible... there are null in GA version and "Dmitrii" in SNAPSHOT. And I don't know why, I've

      changed nothing, but RF version.... Can anybody help me please?


      Thank you very-very much!

        • 1. Re: 3.1.3 GA vs 3.1.3 SNAPSHOT - managed bean trouble (!)
          j-pro

          If anyone can help me solve the problem - please help. I can give all information I have about it. Maybe it's my fault somewhere, maybe not. At least I know that I've changed nothing in my code before update...

          Thanks again.

          • 2. Re: 3.1.3 GA vs 3.1.3 SNAPSHOT - managed bean trouble (!)
            j-pro

            Hmm.. Finally resolved the problem.

            I've just replaced

            <h:commandLink id="editStaffLink" value="#{muiBundle.commonEdit}" styleClass="txtlink" onclick="window.open('/AHRS/editpersdata.jsf','Edit staff')"/>

            with
            <h:outputLink id="editStaffLink" value="/AHRS/editpersdata.jsf" styleClass="txtlink" target="_blank">
             <h:outputText value="#{muiBundle.commonEdit}" />
            </h:outputLink>



            Because(thanks to Maksim Kaszynski advice) I've run it in debug mode and saw that every time the new window with "editpersdata.jsf" opens, the constructor of amBean managed bean is called(that's why it's employee was empty). After that I've debugged it using SNAPSHOT libs. And after debug, it stopped working even here(I don't know why).
            This managed bean's scope is session. I can only assume that the javascript code "window.open" opens new window with the new session. I don't know why is it happening, but it's the way I see it.
            So I've removed window.open and replaced with ordinary "a href" with "target" attribute. And everything works now in both versions.

            The one thing left unknown for me - why it all worked with 3.1.3 SNAPSHOT? I was redeploying and replacing libs a lot of times! So, that's still a question for me.

            P.S.: Sorry for maybe dumb question and for your time while you was reading this post. If there was anything I did wrong in the code, please, feel free to correct me, I'll appreciate it.

            • 3. Re: 3.1.3 GA vs 3.1.3 SNAPSHOT - managed bean trouble (!)
              maksimkaszynski

              Yuri,
              to continue existing session in new window, web server needs to have session id. It can be either request parameter or cookie. In case of output link JSF appends all necessary parameters to href of the a. In case of window.open URL is constructed by yourself with no idea of possible session id parameters.

              • 4. Re: 3.1.3 GA vs 3.1.3 SNAPSHOT - managed bean trouble (!)
                maksimkaszynski

                So server just starts a new session :)