You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vishal Batra <vi...@rediffmail.com> on 2001/05/30 06:49:14 UTC

Tomcat Web Server Problem ( Response has already been committed )

hello ,

i am working on a web based application using JSP on Tomcat Web Server. 
Other tools used are JavaMail 1.1.
I am getting a runtime exception which i have tried to solve but am 
unable to do so. So i have come to u for help.

I have traced out the location where i get this error.

I have a jsp mailTest.jsp which calls method mailUserAboutLoginCreation( 
) of TeamshareMailBean.class
This method accepts 5 String parameters. This method calls method 
sendMessage() of MailGenericBean.class.
It is here that I get a problem. The following code causes the problem ( 
of sendMessage() ).

try
{
message = new MimeMessage( session ) ; // message is 
object of javax.mail.Message class

// session is an object of javax.mail.Session class
}
catch( Exception e )
{
outputWriter.write( "CATCH : Exception while creating 
Message object : " + e ) ;
}
finally
{
outputWriter.write( "FINALLY : Exception while creating 
Message object : " + message ) ;
}

When the above code executes the 'message' object is not instantiated. 
The 'catch' block is not executed while the 'finally' block is 
executing. The code which follows the 'finally' block is not executed.

After this the HTML part of mailTest.jsp which lies above the 
TeamshareMailBean.mailUserAboutLoginCreation( ) appear on my browser 
followed by the exception. Here is the output ( in italics) :

User Name Vishal Batra 
User Email Address batra_vishal@yahoo.com 
Company Login ID SUVI 
User Login ID vishal 
User Password vishal 
M A I L T E S T M A I L T E S T
Error: 500
Location: /teambean/jsp/mailTest.jsp
Internal Servlet Error:

java.lang.IllegalStateException: Response has already been committed
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.(Compiled Code)
at java.lang.Exception.(Compiled Code)
at java.lang.RuntimeException.(RuntimeException.java:47)
at java.lang.IllegalStateException.(IllegalStateException.java:45)
at 
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:157)
at 
org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
at org.apache.tomcat.core.ContextManager.service(Compiled Code)
at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Compiled 
Code)
at org.apache.tomcat.service.TcpConnectionThread.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)

Unfortunately, the above code is giving problem only with Tomcat Web 
Server, version 3.1 and not with version 3.2.1.

In my lab we use Tomcat Web Server 3.2.1 but our Application Service 
Provider uses Tomcat Web Server 3.1

It is working very fine in my lab but not in the uploaded version.

Kindly suggest a solution

Vishal Batra.



_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com





RE: Tomcat Web Server Problem ( Response has already been committed )

Posted by Ross Dyson <rd...@reef.com>.
You're sure the exception is not thrown just BEFORE the instantiation of
your message object?  And then its trying to jump to your error handling JSP
page, but the response is already comitted?

Ross.

-----Original Message-----
From: Vishal Batra [mailto:vishalbatra_@rediffmail.com]
Sent: Wednesday, 30 May 2001 2:49 PM
To: tomcat-user@jakarta.apache.org
Subject: Tomcat Web Server Problem ( Response has already been committed
)


hello ,

i am working on a web based application using JSP on Tomcat Web Server.
Other tools used are JavaMail 1.1.
I am getting a runtime exception which i have tried to solve but am
unable to do so. So i have come to u for help.

I have traced out the location where i get this error.

I have a jsp mailTest.jsp which calls method
lUserAboutLoginCreation( 
) of TeamshareMailBean.class
This method accepts 5 String parameters. This method calls method 
sendMessage() of MailGenericBean.class.
It is here that I get a problem. The following code causes the problem ( 
of sendMessage() ).

try
{
message = new MimeMessage( session ) ; // message is 
object of javax.mail.Message class

// session is an object of javax.mail.Session class
}
catch( Exception e )
{
outputWriter.write( "CATCH : Exception while creating 
Message object : " + e ) ;
}
finally
{
outputWriter.write( "FINALLY : Exception while creating 
Message object : " + message ) ;
}

When the above code executes the 'message' object is not instantiated. 
The 'catch' block is not executed while the 'finally' block is 
executing. The code which follows the 'finally' block is not executed.

After this the HTML part of mailTest.jsp which lies above the 
TeamshareMailBean.mailUserAboutLoginCreation( ) appear on my browser 
followed by the exception. Here is the output ( in italics) :

User Name Vishal Batra 
User Email Address batra_vishal@yahoo.com 
Company Login ID SUVI 
User Login ID vishal 
User Password vishal 
M A I L T E S T M A I L T E S T
Error: 500
Location: /teambean/jsp/mailTest.jsp
Internal Servlet Error:

java.lang.IllegalStateException: Response has already been committed
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.(Compiled Code)
at java.lang.Exception.(Compiled Code)
at java.lang.RuntimeException.(RuntimeException.java:47)
at java.lang.IllegalStateException.(IllegalStateException.java:45)
at 
org.apache.tomcat.core.HttpServletResponseFacade.sendError(HttpServletResponseFacade.java:157)
at 
org.apache.jasper.runtime.JspServlet.unknownException(JspServlet.java:299)
at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
at javax.servlet.http.HttpServlet.service(Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
at org.apache.tomcat.core.ContextManager.service(Compiled Code)
at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Compiled 
Code)
at org.apache.tomcat.service.TcpConnectionThread.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)

Unfortunately, the above code is giving problem only with Tomcat Web 
Server, version 3.1 and not with version 3.2.1.

In my lab we use Tomcat Web Server 3.2.1 but our Application Service 
Provider uses Tomcat Web Server 3.1

It is working very fine in my lab but not in the uploaded version.

Kindly suggest a solution

Vishal Batra.



_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com