4 Replies Latest reply on Aug 9, 2004 9:52 AM by jactor

    IllegalStateException

      I tried to run the J2eeTurorial (Duke's Bank) after installing JBoss. But I got an error when I am trying to log in:
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.coyote.tomcat5.CoyoteRequest.doGetSession(CoyoteRequest.java:2270)
      .
      .
      .

      I hope this is a known issue, so I can continue to learn JBoss ASAP. I have jboss-3.2.6RC1 downloaded and installed. The assemble-app commando on ant (in "Getting Started with JBoss" on page 20) is also screwing up and I had to run it manually. It tries to copy the EAR-file in a directory on JBoss without using backspace( i.e: jboss-3.2.6RC1servedefault)...

      I hope there is a simple solution to the IllegalStateException...

        • 1. Re: IllegalStateException
          genman


          This is a servlet issue. Probably the example is wrong. The first thing you should do, if you want to create a session is to create it before you output anything in the response... Not a JBoss issue, AFAIK.

          • 2. Re: IllegalStateException

            Well thanks, but this does not help me.

            I am new to JBoss (and also Servlets) so I will use JBoss to teach me how to make my own portal and I was also planning to release my new portal on JBoss, but this stop me in my path. I need a solution so I could continue...

            • 3. Re: IllegalStateException
              starksm64

              Edit the bank/web/logoff.jsp page and remove the call to request.getSession(true) after the invalidate call:

              <%@ page import="java.util.*" %>
              <%
               ResourceBundle messages = (ResourceBundle)session.getAttribute("messages");
               request.getSession().invalidate();
               // Remove the following statement
               HttpSession newSession = request.getSession(true);
              %>
              
              <center>
              <h3><%=messages.getString("Farewell")%></h3>
              <h3><a href="<%=request.getContextPath()%>/main"><%=messages.getString("LogonAga
              in")%></a>
              </center>
              



              • 4. Re: IllegalStateException

                Thanx...

                My email has been seen as fake wich I can't understand... I was monitoring this thread by mail, that is why I am so late with answering as I didn't get any more messages...

                I took a brief look at at the jsp, and now I don't get any error, but I still can't log on. I just get forwared to the logoff page. I think I need to study the tutorial in detail to find out what is wrong... In the jsp there is stated a post-action to J_security_chech and I can't find this word in other files than in my jsp's. I don't know which component is invoked when pressing the submit-bgutton...