2 Replies Latest reply on Oct 14, 2002 11:11 AM by dobri

    Double POST

    dobri

      Hi!
      Hope someone can help me.

      I am using JBoss 3.0.3 and Sybase DB.
      When I register a new user I am using JSP(the new user form) that calls servlet(decides what to do - the dispatcher). Then the servlet calls an EJB that saves the new user info in the DB.
      So, when the user submits the form, most of times!(but magically not always) the servlet posts two requests(I see this because have System.out.println()) for registering twice the same form, so I receive an exception that tells me I am trying to save two indentical users (which is forbidden).

      Here it is the error message(note there are 2 doPost() before the error is thrown) :

      10:48:34,030 INFO [STDOUT] doPost(HttpServletRequest request, HttpServletResponse response)
      10:48:34,030 INFO [STDOUT] registerUserID = userManagerFacade.registerUser(userDTO, personValue);
      10:48:34,030 INFO [STDOUT] ================ 1
      10:48:34,030 INFO [STDOUT] ================ 2
      10:48:34,030 INFO [STDOUT] ================ 3
      10:48:34,040 INFO [STDOUT] ================ 4
      10:48:34,040 INFO [STDOUT] ================ 5
      10:48:34,040 INFO [STDOUT] ================ 6
      10:48:34,040 INFO [STDOUT] ================ 7 1866
      10:48:34,040 INFO [STDOUT] ================ 8
      10:48:34,040 INFO [STDOUT] ================ 9
      10:48:34,040 INFO [STDOUT] ================ 10
      10:48:34,040 INFO [STDOUT] ================ 11
      10:48:34,040 INFO [STDOUT] ================ 12
      10:48:34,060 INFO [STDOUT] doPost(HttpServletRequest request, HttpServletResponse response)
      10:48:34,060 INFO [STDOUT] registerUserID = userManagerFacade.registerUser(userDTO, personValue);
      10:48:34,060 INFO [STDOUT] ================ 1
      10:48:34,070 INFO [STDOUT] ================ 2
      10:48:34,070 INFO [STDOUT] ================ 3
      10:48:34,080 INFO [STDOUT] ================ 4
      10:48:34,080 INFO [STDOUT] ================ 5
      10:48:34,080 INFO [STDOUT] ================ 6
      10:48:34,080 INFO [STDOUT] ================ 7 1867
      10:48:34,080 INFO [STDOUT] ================ 8
      10:48:34,080 INFO [STDOUT] ================ 9
      10:48:34,080 INFO [STDOUT] ================ 10
      10:48:34,080 INFO [STDOUT] ================ 11
      10:48:34,080 INFO [STDOUT] ================ 12
      10:48:34,080 INFO [STDOUT] ================ 13
      10:48:34,080 INFO [STDOUT] ================ 14
      10:48:34,090 INFO [STDOUT] ================ 15
      10:48:34,090 INFO [STDOUT] ================ 16
      10:48:34,090 INFO [STDOUT] ================ 17
      10:48:34,090 INFO [STDOUT] ================ 19
      10:48:34,100 INFO [STDOUT] ?!!!!!!!!!!!!!!!!! /main.jsp?
      10:48:34,110 ERROR [User] Could not create entity
      com.sybase.jdbc2.jdbc.SybSQLException: Attempt to insert duplicate key row in object 'USR' with unique index 'USR_169810
      20592'

      at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)
      at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)
      at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)