4 Replies Latest reply on May 30, 2008 6:40 PM by Indrek Altpere

    Odd issue with weblogic

    Indrek Altpere Newbie

      We have a big project done using seam. Production deployment is to weblogic 10
      When we deploy it in glassfish server, everything works fine.
      But in weblogic, there apperas some odd issue with pagecontext.


      We have a searchbox and searchresults. Searchbox is in page scope, search results are also put to page scope for less memory usage.


      When user clicks searchbutton, action method search() gets called on searchbox.


      Which in turn calls method from conversation scoped class that creates a query based on posted values, and puts the query into page scope with Contexts.getPageContext().set(searchResults, results);


      @Name("searchBox")
      @Scope(ScopeType.PAGE)
      @BypassInterceptors
      class SearchBox {
      --snip--
          @Begin(join = true)
          public String search() {
              --calls a conversation scoped class's method to do a search based on posted values--
              //return page location to do a full page refresh
              return "/path/to/mypage.xhtml";
          }
      --snip--
      }



      Results are displayed in xhtml with icefaces datatable.


      <ice:dataTable id="results" var="resultitem" value="#{searchResults}">--snip--</ice:dataTable>



      The problem we're having exactly is like this: user sets some values to searchbox, presses search button, everything is ok. But when user now changes the values in searchbox and does search again, old results are shown at the first page.
      When user navigates to second page, everything goes back to normal, page displayed is the second page based on new input values.


      When debugging the method called from search(), method that puts the result container into page scope, there was something odd. It first did the search with new values, then called Contexts.removeFromAllContexts(searchResults);
      Then did Contexts.getPageContext().set(searchResults, results);
      Now when I did Contexts.getPageContext().get(searchResults); it didn't return the value the code just had put there, but instead the result of previous query, although I had just done removefromallcontexts and set the value to something new.


      I then tested with unifiedvaluebinding


      org.jboss.seam.jsf.UnifiedELValueBinding vb = new org.jboss.seam.jsf.UnifiedELValueBinding("#{searchEstateResults}");
      Object test = vb.getValue(FacesContext.getCurrentInstance());
      vb.setValue(FacesContext.getCurrentInstance(), results);
      Object test2 = vb.getValue(FacesContext.getCurrentInstance());
      Object test3 = Contexts.getPageContext().get("searchResults");
      


      Object test is not same object that was put to pagecontext.
      When I do setValue and then GetValue, then object test2 is the value I put there with setvalue.
      When I try to get the value from pagecontext, I still get the old value.


      Any suggestions or pointers what I may be doing wrong ?


      We also use Icefaces 1.7.0 and currently seam without ejb3 support.


      The odd part is that this behaviour does not appear when deployed in glassfish :(

        • 1. Re: Odd issue with weblogic
          Jay Balunas Novice

          hmmm, what version of Seam are you using?


          Also what jvm are using with weblogic?


          -Jay

          • 2. Re: Odd issue with weblogic
            Jay Balunas Novice

            Below is the javadoc at the top of PageContext.java


            /**The page context allows you to store state during a request that
             * renders a page, and access that state from any postback request
             * that originates from that page. The state is destroyed at the 
             * end of the second request. During the RENDER_RESPONSE phase,
             * the page context instance refers to the page that is about to
             * be rendered. Prior to the INVOKE_APPLICATION phase, it refers
             * to the page that was the source of the request. During the
             * INVOKE_APPLICATION phase, set() and remove() manipulate the
             * context of the page that is about to be rendered, while get()
             * returns values from the page that was the source of the request.
            



            I think this is what you are seeing - the get is returning the value from the original page, and the set(), remove() effect the next page.


            You may need to use a different context for the purpose that you want.  The conversation context would probably work.

            • 3. Re: Odd issue with weblogic
              Jay Balunas Novice

              I forgot to mention that I'm not sure why this did not happen on glassfish.  It should have.


              I'll take a look at it when I can.

              • 4. Re: Odd issue with weblogic
                Indrek Altpere Newbie

                Seam is 2.0.1 GA currently


                Weblogic jvm is the latest available jrockit-R27.5.0-jdk1.6.0_03


                Well, those are stored into page context to preserve memory, because at the end of second request, page context gets destroyed. So that when icefaces request comes to server, the result is still there waiting and would not be fetched from database again.


                It all works nicely in glassfish, but acts oddly in weblogic. :(