0 Replies Latest reply: Jun 1, 2009 12:45 PM by 843807 RSS

    jsp:useBean and scope and persistance of java bean object

    843807
      An application runs on Tomcat Application Server (5.0+) which runs on Alpha VMS OS on a HP box.

      I have the following code in an jsp (genPricingController.jsp) inside HTML body of JSP of that application.
      <body>
      <jsp:useBean id="genPricingBean" scope = "session"
      class= "genPricingPackage.genPricingBean"/>
      <jsp:setProperty name = "genPricingBean" property="*"/>
      </body>

      I have another jsp (genPricing.jsp) which contains fields like Title, prin etc. The user enters data into these fields of this jsp. The value of these fields gets passed to the properties of genPricingBean (see code above)

      The genPricingBean looks like shown below:
      public class genPricingBean {
      public static String displayPage = "";
      public static String errorText = "";
      public static String title = "";
      public static double prinAmount, capAmount;

      public static genPricingBean gp;
      static double prin[];
      static double prinSOT[];
      static double interest[];

      public genPricingBean() {
      }
      public genPricingBean(int max) {
      prin = new double[max];
      prinSOT = new double[max];
      interest = new double[max];
      }

      OTHER METHODS goes here

      public static void main() throws Exception {
      genPricingBean gp = new genPricingBean(genPricingBean.max);
      genPricingBean.setGp(gp);
      generatePrice();
      )
      }
      Problem:
      Lets say an user of the application uses URL of the java application and enters data into the genPricing.JSP mentioned above and runs the application. The application runs fine without any problem.

      Again let us assume the above mentioned user terminates the application/session.

      Now a different user on a different machine uses the same URL and runs the same application in the browser of his machine.

      Let us assume this new user enters all the data on that jsp page except for the field TITLE. Basically, he leaves the TITLE field blank and runs the application. Once again, the application runs fine giving the expected output. But one problem is that the value of the field TITLE entered by the previous user shows up in the output displayed to this user although this user left the TITLE field blank.

      It looks like the bean object created by the jsp:useBean stays in the Tomcat Application server memory even after the user terminated the session/application. I was expecting that the bean gets flushed out when the user terminates the session. Actually, it is not doing that. I am saying this because it shows the value entered by the previous user in a different session at different time.

      There is one other problem exist along with the problem described above. The other problem is that this application brings down the Tomcat application server once in a while (occasionally) but majority of the times it runs fine without bringing down the Tomcat server. This problem might not be caused by the previously described problem above.

      I encounter same problem running on a desktop or HP box at a remote location. However, this problem does not exist when running the same application on oracle OC4J server instance on a desktop. (By the way SUN Form lists java Beans under desktop and therefore I am forces to create this topic under that)

      **Any suggestion/thoughts what causing the above mentioned problems on Tomcat Application server?**

      When it brings down the Tomcat, I see the following in the server log file.
      May 14, 2009 2:45:19 PM org.apache.tomcat.util.net.PoolTcpEndpoint processSocket
      SEVERE: Socket error caused by remote host /10.75.67.79
      java.net.SocketException: Connection reset
      %SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=FFFFFFFFF00D3520, PC=0000000000104CF0, PS=0000001B
      %TRACE-F-TRACEBACK, symbolic stack dump follows

      %CMA-F-EXIT_THREAD, current thread has been requested to exit