Re: IllegalStateException: getOutputStream() has already been called for this response

2005-02-09 Thread DAVID TURNER

Thanks for the advice Roberto. I
agree that the approach is wrong, but in my real application I definitely
use the MVC pattern as much as possible. 

The problem I'm running into is that
my servlet calls other classes to do the business logic. One of these
classes does XSLT. What I end up doing is getting the OutputStream
from the servlet and passing it down to the class that does the transformation,
which sends the results of the transformation to this OutputStream. Exceptions
could possible occur during the transformation, and this is where I run
into this problem of the jsp error page not getting called. The use
of OutputStream or Writer for the XSLT results is what keeps me from doing
exactly what you suggested. I have this one hook, so to speak.

I welcome any suggestions/work-arounds
other than what I'm doing now with the use of the OutputStream in the XSLT
transformation. 

Thanks.







Roberto Cosenza
[EMAIL PROTECTED] 
02/08/2005 04:46 PM



Please respond to
Tomcat Users List tomcat-user@jakarta.apache.org





To
Tomcat Users List
tomcat-user@jakarta.apache.org


cc



Subject
Re: IllegalStateException:
getOutputStream() has already been called for this response








Your approach is bad but don't worry. If you have
time, read something about MVC. You will need it eventually.

To make your servlet work, try something like:
public void doPost(HttpServletRequest req, HttpServletResponse res) 
  
   throws ServletException,
IOException { 
   
  StringBuffer myOutput = new StringBuffer();
  
   
try { 
myOutput.append(Here
I'm not doing anything illegal); 
  
  
  if(true)
  

  
 throw new BookNotFoundException(Book doesn't exist);

} 
catch (Exception e) { 
 System.out.println(Caught
exception:  + e.getMessage()); 
  throw
new ServletException(Dummy Exception, e); 
}

// you reach this only if no errors have been caught so no error page to
display
OutputStream out = res.getOutputStream(); 
res.setContentType(text/plain);
   
out.println(myOutput.toString()); 


}
/roberto




 - Original Message - 
 From: DAVID TURNER 
 To: tomcat-user@jakarta.apache.org 
 Sent: Tuesday, February 08, 2005 9:56 PM
 Subject: IllegalStateException: getOutputStream() has already been
called for this response 



 I'm trying to write a servlet that handles business logic exceptions
by specifying in the web.xml the jsp error page that I want to use for
a specific Exception (see web.xml snippet below). I have this working
when I use response.getWriter() in the servlet instead of response.getOutputStream()
-- see sample servlet code below. But, when I try to use the
response.getOutputStream() approach the jsp error page doesn't work
and an IllegalStateException: getOutputStream() has already been
called for this response  gets thrown because the jsp is probably
trying to get the OutputStream also. 

 Why does the response.getWriter() method work even after headers/data
have been written to the writer? 

 Is there any way to get the jsp error page to work with the getOutputStream()?
 

 I would like to eventually compress the response stream, but from
all the examples I've come across on compression they all use getOutputStream.





 web.xml contents: 

   error-page 
   exception-typeBookNotFoundException/exception-type

   location/jsp/ErrorPage.jsp/location

   /error-page 





 servlet contents: 

 public void doPost(HttpServletRequest req, HttpServletResponse res)

  
throws ServletException,
IOException { 
 PrintWriter
out = res.getWriter(); 

   //OutputStream out = res.getOutputStream();


 res.setContentType(text/plain);

 
 try { 
 out.println(Line
1 of servlet); 
 
  
  //out.write(Line 1 of servlet.getBytes());

  
  
  
  throw new BookNotFoundException(Book doesn't
exist); 
 } 
 catch (Exception e) { 
 res.reset();

  System.out.println(Caught
exception:  + e.getMessage()); 
  
throw new ServletException(Dummy Exception, e); 
 } 
 
 }


--


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: IllegalStateException: getOutputStream() has already been called for this response

2005-02-09 Thread Roberto Cosenza
Just don't pass the ouput stream that you get from the servlet but
create a new one.
When you are done with your business, you'll copy the one on the other.



On Wed, 9 Feb 2005 08:24:05 -0500, DAVID TURNER [EMAIL PROTECTED] wrote:
  
 Thanks for the advice Roberto.  I agree that the approach is wrong, but in
 my real application I definitely use the MVC pattern as much as possible.   
  
 The problem I'm running into is that my servlet calls other classes to do
 the business logic.  One of these classes does XSLT.  What I end up doing is
 getting the OutputStream from the servlet and passing it down to the class
 that does the transformation, which sends the results of the transformation
 to this OutputStream.  Exceptions could possible occur during the
 transformation, and this is where I run into this problem of the jsp error
 page not getting called.  The use of OutputStream or Writer for the XSLT
 results is what keeps me from doing exactly what you suggested.  I have this
 one hook, so to speak. 


-- 
Roberto Cosenza
http://robcos.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException: getOutputStream() has already been called for this response

2005-02-08 Thread Roberto Cosenza
Your approach is bad but don't worry. If you have time, read something about 
MVC. You will need it eventually.

To make your servlet work,  try something like:
public void doPost(HttpServletRequest req, HttpServletResponse res) 
   throws ServletException, IOException { 
 
StringBuffer myOutput = new StringBuffer();
   
try { 
myOutput.append(Here I'm not doing anything illegal); 
   

if(true)   
throw new BookNotFoundException(Book doesn't exist); 
} 
catch (Exception e) { 
  System.out.println(Caught exception:  + e.getMessage()); 
throw new ServletException(Dummy Exception, e); 
}

// you reach this only if no errors have been caught so no error page to display
OutputStream out = res.getOutputStream(); 
res.setContentType(text/plain);
out.println(myOutput.toString()); 


}
/roberto




  - Original Message - 
  From: DAVID TURNER 
  To: tomcat-user@jakarta.apache.org 
  Sent: Tuesday, February 08, 2005 9:56 PM
  Subject: IllegalStateException: getOutputStream() has already been called for 
this response 



  I'm trying to write a servlet that handles business logic exceptions by 
specifying in the web.xml the jsp error page that I want to use for a specific 
Exception (see web.xml snippet below).  I have this working when I use 
response.getWriter() in the servlet instead of response.getOutputStream()  -- 
see sample servlet code below.  But, when I try to use the 
response.getOutputStream() approach the jsp error page  doesn't work and an 
IllegalStateException: getOutputStream() has already been called for this 
response  gets thrown because the jsp is probably trying to get the 
OutputStream also. 

  Why does the response.getWriter() method work even after headers/data have 
been written to the writer? 

  Is there any way to get the jsp error page to work with the 
getOutputStream()?   

  I would like to eventually compress the response stream, but from all the 
examples I've come across on compression they all use getOutputStream. 




  web.xml contents: 

  error-page 
  exception-typeBookNotFoundException/exception-type 
  location/jsp/ErrorPage.jsp/location 
  /error-page 





  servlet contents: 

  public void doPost(HttpServletRequest req, HttpServletResponse res) 
 throws ServletException, IOException { 
  PrintWriter out = res.getWriter(); 

  //OutputStream out = res.getOutputStream(); 

  res.setContentType(text/plain); 
  
  try { 
  out.println(Line 1 of servlet); 
  
  //out.write(Line 1 of servlet.getBytes()); 
  
  throw new BookNotFoundException(Book doesn't 
exist); 
  } 
  catch (Exception e) { 
  res.reset(); 
System.out.println(Caught exception:  + e.getMessage()); 
  throw new ServletException(Dummy Exception, e); 
  } 
  
  }


--


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException

2004-04-20 Thread Christoph P. Kukulies
On Wed, Jul 07, 2004 at 10:28:25PM +0200, Dr. Franz X. Steinparz wrote:
^^


 Hello
 
 I urgently need help.
 

Could you please set the date correctly on your computer, Herr Dr. Steinparz

--
Chris Christoph P. U. Kukulies kuku_at_physik.rwth-aachen.de

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException

2004-04-08 Thread QM
On Wed, Jul 07, 2004 at 10:28:25PM +0200, Dr. Franz X. Steinparz wrote:
: The application works fine within Oracles IDE and it's built in servlet
: runner. However after deploying the app to Tomcat, Tomcat raises an
: IllegalStateException 
: (java.lang.IllegalStateException
: 
org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399)
: ... 
: when a reponse object is handed over to another servlet.

Perhaps:

http://www.jguru.com/faq/view.jsp?EID=501393

Otherwise:
Full stack trace, please?

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IllegalStateException

2004-04-08 Thread Berry, Layton
Check the javadoc for HttpServletResponse.sendRedirect(String),
an interface that CoyoteResponseFacade implements.
Did your servlet commit a response, or have a bad URL?

If you've written output before the sendRedirect,
you may have filled the output buffer, thereby committing it.

Layton Berry

-Original Message-
From: Dr. Franz X. Steinparz [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 07, 2004 12:28 PM
To: Tomcat Users List
Subject: IllegalStateException


Hello

I urgently need help.

I have a problem deploying an application developped under Oracles
JDeveloper to Tomcat. The application consists of several servlets,
passing over request and esponse objects from one servlet to another.

The application works fine within Oracles IDE and it's built in servlet
runner. However after deploying the app to Tomcat, Tomcat raises an
IllegalStateException 
(java.lang.IllegalStateException

org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(Coy
oteResponseFacade.java:399)
... 
when a reponse object is handed over to another servlet.

thank you

franz steinparz
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException

2004-04-08 Thread Tim Funk
Once you perform a sendRedirect or the response is committed, it is illegal 
to call sendRedirect again. (I am guessing sendRedirect is being called twice 
in the life of the request)

-Tim

Dr. Franz X. Steinparz wrote:
Hello

I urgently need help.

I have a problem deploying an application developped under Oracles
JDeveloper to Tomcat. The application consists of several servlets,
passing over request and esponse objects from one servlet to another.
The application works fine within Oracles IDE and it's built in servlet
runner. However after deploying the app to Tomcat, Tomcat raises an
IllegalStateException 
(java.lang.IllegalStateException
org.apache.coyote.tomcat5.CoyoteResponseFacade.sendRedirect(CoyoteResponseFacade.java:399)
... 
when a reponse object is handed over to another servlet.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException in catalina.out

2003-09-15 Thread Tim Funk
http://jakarta.apache.org/tomcat/faq/misc.html#illegalstate

-Tim

[EMAIL PROTECTED] wrote:

Hello!

I am using:
TC4.1.24,
jdk1.4.1,
Apache ,
ajp13 connector,
on Unix SunOS 5.8.
I sometimes get following errors in the catalina.out:
java.lang.IllegalStateException: Current state = FLUSHED, new state =
CODING_END
  at
java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:933)
  at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:529)
  at
sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:356)
  at
sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:412)
  at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:158)
  at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
  at java.io.PrintWriter.close(PrintWriter.java:137)
  at
org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:483)
  at
org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:253)
  at
org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:191)
  at
org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:488)
  at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585)
  at java.lang.Thread.run(Thread.java:536)
If I run my programms under WIN2000 and the same configurations as above, I
don't get this erros.
Does anyone has an answer?
Michael Sonnleitner


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()

2003-09-02 Thread YErkan




Thanks guys!

I went through the code last night, after sending the e-mail. I think I found
the problem. Our developer uses dynamically included JSP declaring
session=true (by not declaring anything) while the parent declares
session=false.

We'll go through a set of tests anyway. I'm ashamed to doubt about Tomcat now
;-).

Take care all!

 - Yagiz Erkan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()

2003-09-01 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
Hi all,

We're running Tomcat 4.1.24 on Win2K sp4. After a few days of use (usually 4-5
days), Tomcat comes to a semi-halt mode and it refuses to process some of the
pages. Even the thrown exceptions are not logged. It looks like it's a thread
pool related problem because, apparently, the connector runs out of threads. I
know that if an error occurs, the thread is supposed to be discarded from the
pool to keep the consistency and the integrity however I don't understand why
they aren't created again...
Please have a look at the stack trace below. Any help/advice would be greatly
appreciated! ;-)
Thanks,

Stack Trace follows:

2003-08-31 01:37:30 JspFactoryImpl: Exception initializing page context
java.lang.IllegalStateException: Cannot create a session after the response has
been committed
Well, this is a valid error, and doesn't indicate a problem.

As for TC running out of threads, you should do a thread dump to see 
what's going on (ctrl+break on Windows in the TC console; I don't know 
how to do it if TC is running as a service).

If the issues persist, you could test TC 5.0.9 beta, which has 
scalability improvements.

Remy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()

2003-09-01 Thread YErkan




 Well, this is a valid error, and doesn't indicate a problem.

Remy,

Thanks for your prompt answer. Please don't get me wrong, I don't want to sound
arrogant or something, but how come an error may not indicate a problem. ;-)

We've already gotten the thread dump. I'll have a look into that as well.

Any more ideas? Anybody else maybe? :-)

Thanks again,

 - Yagiz Erkan


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()

2003-09-01 Thread Tim Funk
The stack trace you posted has to do with committing the reponse (which 
actually means sending data back to the client instead of sitting in a 
buffer), then trying to allocate a session. Allocating a NEW session involves 
sending a cookie back to the client to let the client be aware of the new 
session (so there may be a session).

Well, cookies can NOT be created after the response has been committed since 
the header has already been sent to the client.

So ... look into your code and determine where you you may create a new 
session. Then when that may occur, see if the state may have been previously 
committed for some reason.

The servlet spec has more details about this.

-Tim

[EMAIL PROTECTED] wrote:




Well, this is a valid error, and doesn't indicate a problem.


Remy,

Thanks for your prompt answer. Please don't get me wrong, I don't want to sound
arrogant or something, but how come an error may not indicate a problem. ;-)
We've already gotten the thread dump. I'll have a look into that as well.

Any more ideas? Anybody else maybe? :-)

Thanks again,

 - Yagiz Erkan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException - org.apache.coyote.tomcat4.CoyoteRequest.doGetSession()

2003-09-01 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
Thanks for your prompt answer. Please don't get me wrong, I don't want to sound
arrogant or something, but how come an error may not indicate a problem. ;-)
It indicates there's likely a bug in the app, not in TC (that's what I 
meant). You can't create a session if the response has already been 
committed (a flush or writing a relatively large amount of data would do 
that).

We've already gotten the thread dump. I'll have a look into that as well.

Any more ideas? Anybody else maybe? :-)
Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException on JSP page

2003-03-27 Thread Erik Price


Kenny G. Dubuisson, Jr. wrote:
Hello all.  I've got a simple JSP page which is throwing an
IllegalStateException when I try to redirect the output to another page.
What is the stack trace?

Here is a snippet of the code:

 login = login.toUpperCase();
 Connection myConnection =
DriverManager.getConnection(url, login, password);
 String sessionId = session.getId();
 Cookie cookie = new Cookie(sessionId, sessionId);
 response.addCookie(cookie);
 session.putValue(username, login);
 session.putValue(password, password);
 response.sendRedirect(rep_main.jsp);
 myConnection.close();
I have found that debugging JSPs is a pain in the ass.  If you can 
refactor this code to a servlet or even just some external Java objects 
(hint: you can then access the data from the JSP using JavaBeans), you 
can keep your JSP cleaner, which means less debugging of JSPs.

I've searched through all the archives and never was able to find a solution
to this for my case.  One thing I did read was about having to have a
web.xml file for my application (I currently don't have one nor know what
to put in one).
It is helpful to have this so you can specify context- and servlet- 
parameters as well as to perform servlet mappings.  But I suppose if 
your app uses only JSPs it is not necessary?  (Not sure.)

If you think this is the problem could you forward a
simple/basic web.xml?  Thanks in advance,
Sure, there is one at:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/web.xml.txt

Erik

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException on JSP page

2003-03-27 Thread Kenny G. Dubuisson, Jr.
The full stack trace is:

2003-03-27 09:26:01 StandardWrapperValve[jsp]: Servlet.service() for servlet
jsp threw exception
java.lang.IllegalStateException
at
org.apache.catalina.connector.HttpResponseFacade.sendRedirect(HttpResponseFa
cade.java:173)
at
org.apache.jsp.sales_0005frep$jsp._jspService(sales_0005frep$jsp.java:88)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at
org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:536)

Hope this helps,
Kenny

- Original Message -
From: Erik Price [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 9:51 AM
Subject: Re: IllegalStateException on JSP page




 Kenny G. Dubuisson, Jr. wrote:
  Hello all.  I've got a simple JSP page which is throwing an
  IllegalStateException when I try to redirect the output to another page.

 What is the stack trace?

  Here is a snippet of the code:
 
   login = login.toUpperCase();
   Connection myConnection =
  DriverManager.getConnection(url, login, password);
   String sessionId = session.getId();
   Cookie cookie = new Cookie(sessionId, sessionId);
   response.addCookie(cookie);
   session.putValue(username, login);
   session.putValue(password, password);
   response.sendRedirect(rep_main.jsp);
   myConnection.close();

 I have found that debugging JSPs is a pain in the ass.  If you can
 refactor this code to a servlet or even just some external Java objects
 (hint: you can then access the data from the JSP using JavaBeans), you
 can keep your JSP cleaner, which means less debugging of JSPs.

  I've searched through all the archives and never was able to find a
solution
  to this for my case.  One thing I did read was about having to have a
  web.xml file for my application (I currently don't have one nor know
what
  to put in one).

 It is helpful to have this so you can specify context- and servlet

Re: IllegalStateException on JSP page

2003-03-27 Thread Ramsay Domloge
Kenny,

I am not sure of my facts here, but I believe that 
response.sendRedirect() may close the response. If you then attempt to 
write to the response afterwards, you get an IllegalStateException. 
Since your code is in a JSP page, this causes problems - after Tomcat 
has processed the scriptlet, it will continue over the remainder of the 
page and output it to the client - any HTML tags, new lines or even 
white space after the end of the scriptlet will be written to the 
response. This will cause an exception.

As someone has already stated here, this sort of code is much better 
suited to a Servlet. However, if you are looking for a quick and dirty 
fix, you could always add this HTML  after the scriptlet:

!doctype html public -//w3c//dtd html 3.2//en
html
head
META http-equiv=refresh content=0; URL=[ENTER PAGE HERE}
/head
/html
This will cause the browser to then request the new page which you 
specify. This is an awful way to solve the problem, but hopefully it 
helps...

Ramsay



Kenny G. Dubuisson, Jr. wrote:

Hello all.  I've got a simple JSP page which is throwing an
IllegalStateException when I try to redirect the output to another page.
Here is a snippet of the code:
login = login.toUpperCase();
Connection myConnection =
   DriverManager.getConnection(url, login, password);
String sessionId = session.getId();
Cookie cookie = new Cookie(sessionId, sessionId);
response.addCookie(cookie);
session.putValue(username, login);
session.putValue(password, password);
response.sendRedirect(rep_main.jsp);
myConnection.close();
I've searched through all the archives and never was able to find a solution
to this for my case.  One thing I did read was about having to have a
web.xml file for my application (I currently don't have one nor know what
to put in one).  If you think this is the problem could you forward a
simple/basic web.xml?  Thanks in advance,
Kenny
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

   

   
   A R K E M E D I A   T E C H N O L O G I E S   L T D 
   
  VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG
   
 http://www.arkemedia.com  
   
mailto:[EMAIL PROTECTED]  
   
Tel : +44 1256 869 200  Fax : +44 1256 329 119 
   

   
The information in this e-mail and in any attachments is confidential and  
is intended solely for the attention and use of the named addressee(s).
   

   
If you are not the intended recipient, or a person responsible for passing 
it on to the intended recipient, you are not authorised to hold a copy of  
this information and you must therefore not disclose, copy, distribute, or 
retain this message or any part of it. MAILTO:[EMAIL PROTECTED]  
   




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: IllegalStateException on JSP page

2003-03-27 Thread Kenny G. Dubuisson, Jr.
Thanks for the info.  The weird thing is that my JSP page worked fine for
days and then it just stopped working.  I've made no changes to it at all.
I totally don't understand why it would have worked and then stopped.
Thanks,
Kenny

- Original Message -
From: Ramsay Domloge [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 10:36 AM
Subject: Re: IllegalStateException on JSP page


 Kenny,

 I am not sure of my facts here, but I believe that
 response.sendRedirect() may close the response. If you then attempt to
 write to the response afterwards, you get an IllegalStateException.
 Since your code is in a JSP page, this causes problems - after Tomcat
 has processed the scriptlet, it will continue over the remainder of the
 page and output it to the client - any HTML tags, new lines or even
 white space after the end of the scriptlet will be written to the
 response. This will cause an exception.

 As someone has already stated here, this sort of code is much better
 suited to a Servlet. However, if you are looking for a quick and dirty
 fix, you could always add this HTML  after the scriptlet:

 !doctype html public -//w3c//dtd html 3.2//en
 html
 head
 META http-equiv=refresh content=0; URL=[ENTER PAGE HERE}
 /head
 /html

 This will cause the browser to then request the new page which you
 specify. This is an awful way to solve the problem, but hopefully it
 helps...

 Ramsay



 Kenny G. Dubuisson, Jr. wrote:

 Hello all.  I've got a simple JSP page which is throwing an
 IllegalStateException when I try to redirect the output to another page.
 Here is a snippet of the code:
 
  login = login.toUpperCase();
  Connection myConnection =
 DriverManager.getConnection(url, login, password);
  String sessionId = session.getId();
  Cookie cookie = new Cookie(sessionId, sessionId);
  response.addCookie(cookie);
  session.putValue(username, login);
  session.putValue(password, password);
  response.sendRedirect(rep_main.jsp);
  myConnection.close();
 
 I've searched through all the archives and never was able to find a
solution
 to this for my case.  One thing I did read was about having to have a
 web.xml file for my application (I currently don't have one nor know
what
 to put in one).  If you think this is the problem could you forward a
 simple/basic web.xml?  Thanks in advance,
 Kenny
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 





 A R K E M E D I A   T E C H N O L O G I E S   L T D

VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG

   http://www.arkemedia.com

  mailto:[EMAIL PROTECTED]

  Tel : +44 1256 869 200  Fax : +44 1256 329 119




  The information in this e-mail and in any attachments is confidential and
  is intended solely for the attention and use of the named addressee(s).




  If you are not the intended recipient, or a person responsible for
passing
  it on to the intended recipient, you are not authorised to hold a copy of
  this information and you must therefore not disclose, copy, distribute,
or
  retain this message or any part of it. MAILTO:[EMAIL PROTECTED]






 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException on JSP page

2003-03-27 Thread Kenny G. Dubuisson, Jr.
I'm starting to think that my Tomcat installation is now broken.  All of my
code worked yesterday and now none of it works and I didn't change anything.
Has anyone seen something like this before?  I'm running Tomcat 4.0.6.  I
hate to reinstall everything on a whim but I don't know what else to do at
this point.  Thanks,
Kenny

- Original Message -
From: Kenny G. Dubuisson, Jr. [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Thursday, March 27, 2003 10:40 AM
Subject: Re: IllegalStateException on JSP page


 Thanks for the info.  The weird thing is that my JSP page worked fine for
 days and then it just stopped working.  I've made no changes to it at all.
 I totally don't understand why it would have worked and then stopped.
 Thanks,
 Kenny

 - Original Message -
 From: Ramsay Domloge [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, March 27, 2003 10:36 AM
 Subject: Re: IllegalStateException on JSP page


  Kenny,
 
  I am not sure of my facts here, but I believe that
  response.sendRedirect() may close the response. If you then attempt to
  write to the response afterwards, you get an IllegalStateException.
  Since your code is in a JSP page, this causes problems - after Tomcat
  has processed the scriptlet, it will continue over the remainder of the
  page and output it to the client - any HTML tags, new lines or even
  white space after the end of the scriptlet will be written to the
  response. This will cause an exception.
 
  As someone has already stated here, this sort of code is much better
  suited to a Servlet. However, if you are looking for a quick and dirty
  fix, you could always add this HTML  after the scriptlet:
 
  !doctype html public -//w3c//dtd html 3.2//en
  html
  head
  META http-equiv=refresh content=0; URL=[ENTER PAGE HERE}
  /head
  /html
 
  This will cause the browser to then request the new page which you
  specify. This is an awful way to solve the problem, but hopefully it
  helps...
 
  Ramsay
 
 
 
  Kenny G. Dubuisson, Jr. wrote:
 
  Hello all.  I've got a simple JSP page which is throwing an
  IllegalStateException when I try to redirect the output to another
page.
  Here is a snippet of the code:
  
   login = login.toUpperCase();
   Connection myConnection =
  DriverManager.getConnection(url, login, password);
   String sessionId = session.getId();
   Cookie cookie = new Cookie(sessionId, sessionId);
   response.addCookie(cookie);
   session.putValue(username, login);
   session.putValue(password, password);
   response.sendRedirect(rep_main.jsp);
   myConnection.close();
  
  I've searched through all the archives and never was able to find a
 solution
  to this for my case.  One thing I did read was about having to have a
  web.xml file for my application (I currently don't have one nor know
 what
  to put in one).  If you think this is the problem could you forward a
  simple/basic web.xml?  Thanks in advance,
  Kenny
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 


 
  A R K E M E D I A   T E C H N O L O G I E S   L T D
 
 VIEW POINTBASING VIEWBASINGSTOKEHAMPSHIRERG21 4RG
 
http://www.arkemedia.com
 
   mailto:[EMAIL PROTECTED]
 
   Tel : +44 1256 869 200  Fax : +44 1256 329 119
 
 


 
   The information in this e-mail and in any attachments is confidential
and
   is intended solely for the attention and use of the named addressee(s).
 
 


 
   If you are not the intended recipient, or a person responsible for
 passing
   it on to the intended recipient, you are not authorised to hold a copy
of
   this information and you must therefore not disclose, copy, distribute,
 or
   retain this message or any part of it.
MAILTO:[EMAIL PROTECTED]
 
 


 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: IllegalStateException on JSP page

2003-03-27 Thread Craig R. McClanahan
On Thu, 27 Mar 2003, Kenny G. Dubuisson, Jr. wrote:

 Date: Thu, 27 Mar 2003 09:43:45 -0600
 From: Kenny G. Dubuisson, Jr. [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Subject: IllegalStateException on JSP page

 Hello all.  I've got a simple JSP page which is throwing an
 IllegalStateException when I try to redirect the output to another page.
 Here is a snippet of the code:

  login = login.toUpperCase();
  Connection myConnection =
 DriverManager.getConnection(url, login, password);
  String sessionId = session.getId();
  Cookie cookie = new Cookie(sessionId, sessionId);
  response.addCookie(cookie);
  session.putValue(username, login);
  session.putValue(password, password);
  response.sendRedirect(rep_main.jsp);
  myConnection.close();

 I've searched through all the archives and never was able to find a solution
 to this for my case.  One thing I did read was about having to have a
 web.xml file for my application (I currently don't have one nor know what
 to put in one).  If you think this is the problem could you forward a
 simple/basic web.xml?  Thanks in advance,
 Kenny


Getting an IllegalStateException is exactly what should happen if the
response has already been committed back to the client before this code is
executed.  When the response has been committed (because you've already
written more characters than the size of the response buffer), the HTTP
headers have already been sent -- and it is no longer possible to do a
redirect.

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IllegalStateException??? Please help!

2002-11-26 Thread Steve Beech
Johan,

Thanks for your reply.

I've restarted Tomcat but that seems to be when the problem happens. (I say
problem though it isn't affecting the program!)
And I'm not using servlets.

Thanks anyway,

Let me know if you have anymore thoughts.

Cheers,

Steve

-Original Message-
From: Johan Bryssling [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2002 15:07
To: Tomcat Users List
Subject: RE: IllegalStateException??? Please help!


Hi..

Compiled servlets recently?

Try restart tomcat and reconnect...

The problem sometimes happens to me when I compile servlets and try to
access them direct after. The solution is to restart tomcat (in that case).
Perhaps your case is similar.

Regards

/Johan

-Original Message-
From: Steve Beech [mailto:[EMAIL PROTECTED]]
Sent: den 26 november 2002 12:02
To: 'Tomcat Users List'
Subject: IllegalStateException??? Please help!


I've set up a SSL socket in Tomcat and everything appears to work okay. I
can connect to the port, install the cert and access the site.

However, when I access the HTTPS port with my browser and get the 'Security
Alert' prompt telling me about the certificate and asking me if I want to
continue, then I get the following message scrolling continually within the
Tomcat window.

2002-11-20 15:25:31 - Ctx(  ): IllegalStateException in: R( /) Current state
= F
LUSHED, new state = CODING
2002-11-20 15:25:31 - Ctx(  ): IllegalStateException in: R( /) Current state
= F
LUSHED, new state = CODING
2002-11-20 15:25:31 - Ctx(  ): IllegalStateException in: R( /) Current state
= F
LUSHED, new state = CODING

Can anybody tell me what this means and how I might prevent it from
happening?

Thanks

Steve



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: IllegalStateException Error

2002-10-18 Thread Carl W. Jolly
try reset() ing the  response before sending the redirect. You should
not write to the response object if you are going to redirect/forward it
to another resources that will output to the  response object. 
response.reset();
also redirecting will not stop the thread from
executing the remainder of the code so you should
put in a return statement after the redirect





On Thu, 2002-10-17 at 11:12, Lior Shliechkorn wrote:
 
 
 
  From:Carl [EMAIL PROTECTED] on 10/17/2002 09:12 AM MST  
 
 
 
 



  I'm trying to do some checking on my pages that make sure that the
  user logged out and all the attributes that were bounded to the   
  session were destroyed (using session.invalidate() in the logout  
  page). However, I'm running into difficulties with 1 of my pages. 

  The check works fine on all the other pages except this one. I try to 
  response.sendRedirect() the page to the login page again, but it  
  seems to ignore it and I get errors that I can't forward after a  
  response has been committed. And other times it logs the user right   
  back in as if nothing happened after the user logged out...it's only  
  with this one page.   

  here's the code. I'm not sure what could be wrong:

  %@ page session=true %
  %@ page contentType=text/html;charset=WINDOWS-1252 %  
  %@ page import = java.util.*, java.sql.*, java.util.Vector.* %
  jsp:useBean id=pool class=ConnectionPool scope=application /  
  %
  response.setHeader(pragma, no-cache); 
  response.setHeader(Cache-Control, no-cache);  
  response.setHeader(Expires, 0);   

  Connection conn = null;   
  String asql = null;   
  Statement stmt = null;
  ResultSet rs = null;  
  String aUserID = null;
  String aPassword = null;  

  try   
  { 
 FB user = (FB) session.getAttribute(bean);   
  //*** 
  //  FormBean Exists   
  //*** 
 if (user != null)  
 {  
 aUserID = user.getUSER_ID();   
   aPassword = user.getPASSWORD();  
 }  
  //*** 
  //  No session bean exists
  //*** 
else
  { 
  response.sendRedirect(../html/ReLogin.html);
}   
  //
  // INITIALIZE THE POOL
  //
if (pool.getDriver() == null)   
{   
  pool.init();  
  pool.initializePool(); 

RE: IllegalStateException Error

2002-10-18 Thread Cox, Charlie
ok, several problems here:
1. place a 'return;' after your sendRedirect()
2. remove unintended whitespace from your jsp:
change
   %
 jsp:forward page=daily.jsp/jsp:forward
 %

to
 %jsp:forward page=daily.jsp/jsp:forward%

3. post your error messages with stack trace. I happen to recognize
'response already committed', but others may not.

4. search the archives:
http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/
Illegalstateexception returns many hits and 'response already committed'
returns more specific to your problem. These will probably give you more
detail than I can remember right now.

#3 and #4 will help you get an answer quicker. Please also remember that not
everyone gets to all messages on the list within the 3 hours that you have
allowed.

Charlie

 -Original Message-
 From: Lior Shliechkorn [mailto:liorshliech;yahoo.com]
 Sent: Thursday, October 17, 2002 12:12 PM
 To: Tomcat
 Subject: IllegalStateException Error
 
 
 
 I'm trying to do some checking on my pages that make sure 
 that the user logged out and all the attributes that were 
 bounded to the session were destroyed (using 
 session.invalidate() in the logout page). However, I'm 
 running into difficulties with 1 of my pages.
 
 The check works fine on all the other pages except this one. 
 I try to response.sendRedirect() the page to the login page 
 again, but it seems to ignore it and I get errors that I 
 can't forward after a response has been committed. And other 
 times it logs the user right back in as if nothing happened 
 after the user logged out...it's only with this one page.
 
 here's the code. I'm not sure what could be wrong:
 
 % page session=true %
 % page contentType=text/html;charset=WINDOWS-1252 %
 % page import = java.util.*, java.sql.*, java.util.Vector.* %
 jsp:useBean id=pool class=ConnectionPool scope=application /
 %
 response.setHeader(pragma, no-cache);
 response.setHeader(Cache-Control, no-cache);
 response.setHeader(Expires, 0);
 
 Connection conn = null;
 String asql = null;
 Statement stmt = null;
 ResultSet rs = null;
 String aUserID = null;
 String aPassword = null;
 
 try
 {
FB user = (FB) session.getAttribute(bean);
 //***
 //  FormBean Exists
 //***
if (user != null) 
{
aUserID = user.getUSER_ID();
  aPassword = user.getPASSWORD();
}
 //***
 //  No session bean exists
 //***
   else 
 {
 response.sendRedirect(../html/ReLogin.html);
   }
 //
 // INITIALIZE THE POOL
 //
   if (pool.getDriver() == null)
   {
 pool.init();
 pool.initializePool();
   }
 
   boolean aloginflag = false;
   conn = pool.getConnection();
 
   stmt = conn.createStatement();
   asql = getSqlStatement();
   System.out.println(asql);
   String accesscode = null;
   rs = stmt.executeQuery(asql);
   while (rs.next())
   {
   aloginflag = true;
 System.out.println(Login successful!);
 accesscode = rs.getString(ACCESS_CODE);
 user.setACCESSCODE(accesscode);
 System.out.println(accesscode);
   } // end while 
  
if(aloginflag)
{}
else
{
 %
   jsp:forward page=../html/LoginError.html/jsp:forward
   %
} 
if (accesscode.equalsIgnoreCase(B))
{
   %
 jsp:forward page=daily.jsp/jsp:forward
 %
} // end if
else if (accesscode.equalsIgnoreCase(C))
{
   %
 jsp:forward page=report2.jsp/jsp:forward
 %
} // end else if
else if (accesscode.equalsIgnoreCase(G))
{
   %
 jsp:forward page=report.jsp/jsp:forward
 %
} // end else if
else if (accesscode.equalsIgnoreCase(U))
{
   %
 jsp:forward page=news.jsp/jsp:forward
 %
} // end else if
else
{
   System.out.println(No account found in the database!);
   response.sendRedirect(../html/LoginError.html);
} // end else
   }
   catch(SQLException e) 
   {
 // Login SQL Error!
 response.sendRedirect(../html/LoginError.html);
   }
   catch(ClassNotFoundException e) 
   {
   // Classname Error!
   response.sendRedirect(../html/DBConnError.html);
 }
 finally 
  {
   try 
{
 if (stmt != null) stmt.close();
if (rs != null) rs.close();
 if (conn != null ) pool.releaseConnection(conn);
   }
   catch (Exception sqlex) 
{
 response.sendRedirect(../html/LoginError.html);
   }
 }
 %
 
 I find that it totally disregards the 

RE: IllegalStateException Error

2002-10-18 Thread Lior Shliechkorn

The return works. Thanks. I still really don't understand what was happening that it 
was committing the response. It was giving me a java.lang.IllegalStateException : 
cannot forward response has been committed... And it only gives me this error on this 
page...the other pages have the same exact code with checking the session beans and it 
works. Strange.
 Cox, Charlie [EMAIL PROTECTED] wrote:ok, several problems here:
1. place a 'return;' after your sendRedirect()
2. remove unintended whitespace from your jsp:
change
%


to
 %
3. post your error messages with stack trace. I happen to recognize
'response already committed', but others may not.

4. search the archives:
http://www.mail-archive.com/tomcat-user%40jakarta.apache.org/
Illegalstateexception returns many hits and 'response already committed'
returns more specific to your problem. These will probably give you more
detail than I can remember right now.

#3 and #4 will help you get an answer quicker. Please also remember that not
everyone gets to all messages on the list within the 3 hours that you have
allowed.

Charlie

 -Original Message-
 From: Lior Shliechkorn [mailto:liorshliech;yahoo.com]
 Sent: Thursday, October 17, 2002 12:12 PM
 To: Tomcat
 Subject: IllegalStateException Error
 
 
 
 I'm trying to do some checking on my pages that make sure 
 that the user logged out and all the attributes that were 
 bounded to the session were destroyed (using 
 session.invalidate() in the logout page). However, I'm 
 running into difficulties with 1 of my pages.
 
 The check works fine on all the other pages except this one. 
 I try to response.sendRedirect() the page to the login page 
 again, but it seems to ignore it and I get errors that I 
 can't forward after a response has been committed. And other 
 times it logs the user right back in as if nothing happened 
 after the user logged out...it's only with this one page.
 
 here's the code. I'm not sure what could be wrong:
 
 
 
 
 
  response.setHeader(pragma, no-cache);
 response.setHeader(Cache-Control, no-cache);
 response.setHeader(Expires, 0);
 
 Connection conn = null;
 String asql = null;
 Statement stmt = null;
 ResultSet rs = null;
 String aUserID = null;
 String aPassword = null;
 
 try
 {
FB user = (FB) session.getAttribute(bean);
 //***
 //  FormBean Exists
 //***
if (user != null) 
{
aUserID = user.getUSER_ID();
  aPassword = user.getPASSWORD();
}
 //***
 //  No session bean exists
 //***
   else 
 {
 response.sendRedirect(../html/ReLogin.html);
   }
 //
 // INITIALIZE THE POOL
 //
   if (pool.getDriver() == null)
   {
 pool.init();
 pool.initializePool();
   }
 
   boolean aloginflag = false;
   conn = pool.getConnection();
 
   stmt = conn.createStatement();
   asql = getSqlStatement();
   System.out.println(asql);
   String accesscode = null;
   rs = stmt.executeQuery(asql);
   while (rs.next())
   {
   aloginflag = true;
 System.out.println(Login successful!);
 accesscode = rs.getString(ACCESS_CODE);
 user.setACCESSCODE(accesscode);
 System.out.println(accesscode);
   } // end while 
  
if(aloginflag)
{}
else
{
 %
 
 } 
if (accesscode.equalsIgnoreCase(B))
{
   %
 
 } // end if
else if (accesscode.equalsIgnoreCase(C))
{
   %
 
 } // end else if
else if (accesscode.equalsIgnoreCase(G))
{
   %
 
 } // end else if
else if (accesscode.equalsIgnoreCase(U))
{
   %
 
 } // end else if
else
{
   System.out.println(No account found in the database!);
   response.sendRedirect(../html/LoginError.html);
} // end else
   }
   catch(SQLException e) 
   {
 // Login SQL Error!
 response.sendRedirect(../html/LoginError.html);
   }
   catch(ClassNotFoundException e) 
   {
   // Classname Error!
   response.sendRedirect(../html/DBConnError.html);
 }
 finally 
  {
   try 
{
 if (stmt != null) stmt.close();
if (rs != null) rs.close();
 if (conn != null ) pool.releaseConnection(conn);
   }
   catch (Exception sqlex) 
{
 response.sendRedirect(../html/LoginError.html);
   }
 }
 %
 
 I find that it totally disregards the lines after the TRY 
 statement and even after I log out I can still see that when 
 I hit the back button it process the sql query and doesn't 
 

Re: IllegalStateException while using SSL

2002-09-08 Thread Bill Barker

In general, you get better responses if you mention which Tomcat version you
are using.  Having spent way too much time on this list :), I'm guessing
that you are using a 3.2.x version.  If possible you should try upgrading to
at least 3.3.1 (and, for HTTPS, upgrade to the CoyoteConnector to take
advantage of keep-alive).

hari@acusis [EMAIL PROTECTED] wrote in message
00be01c2562a$bae17c70$fa00a8c0@faustbuch">news:00be01c2562a$bae17c70$fa00a8c0@faustbuch...
 Hi,

 I setup SSL in Tomcat using JSEE and the key is generated using the
 keytool utility. The system is working fine, but the server is throwing
 an IllegalStateException continuously while accessing any page through
 HTTPS. This never stops and after few minutes of throwing the exception,
 it gices an OutOfMemory error and stops there. [Till then it
 successfully serves all pages through HTTPS]. The exception thrown is
 copied below.


 2002-09-07 10:11:24 - Ctx(  ): IllegalStateException in: R( /) Current
 state = FLUSHED, new state = CODING


 Any ideas why this is happening and how to resolve this?


 Thx,
 Hari.






--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: IllegalStateException in releasePageContext

2002-01-25 Thread Wagoner, Mark

Do you happen to have include directives with flush=true.  If so, take the
flush attribute out.  This helped me, anyway.

-Original Message-
From: Robert Winningham [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 9:46 AM
To: [EMAIL PROTECTED]
Subject: IllegalStateException in releasePageContext


I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now
receiving many errors in my error log (one for each time a user hits a
.jsp page.)  This is causing my logs to grow VERY quickly.  I did not
receive these types of errors in 3.2.x.  The errors are all in the
following format:

2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.getWriter
(ResponseFacade.java:159) (pc 11)
at org.apache.jasper.runtime.JspWriterImpl.initOut
(JspWriterImpl.java:166) (pc 12)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer
(JspWriterImpl.java:158) (pc 39)
at org.apache.jasper.runtime.JspWriterImpl.flush
(JspWriterImpl.java:205) (pc 8)
at org.apache.jasper.runtime.PageContextImpl.release
(PageContextImpl.java:176) (pc 24)
at
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext
(JspFactoryImpl.java:198) (pc 1)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext
(JspFactoryImpl.java:193) (pc 32)
at org.apache.jsp.eppersonal$jsp._jspService
(eppersonal$jsp.java:270) (pc 1207)
at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:107) (pc 3)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:199) (pc 33)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:382) (pc 60)
at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:474) (pc 326)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247) (pc 248)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193) (pc 98)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243) (pc 352)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:201) (pc 261)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246) (pc 48)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2344) (pc 26)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:164) (pc 99)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:462) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:163) (pc 92)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1011) (pc 363)
at 

RE: IllegalStateException in releasePageContext

2002-01-25 Thread Robert Winningham

Mark,

Thank you for your advice.  I tried your recommendation, but I am still
receiving the errors.  Any other thoughts?  

Any advice is much appreciated.

//rob

-Original Message-
From: Wagoner, Mark [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 8:56 AM
To: 'Tomcat Users List'
Subject: RE: IllegalStateException in releasePageContext


Do you happen to have include directives with flush=true.  If so, take
the
flush attribute out.  This helped me, anyway.

-Original Message-
From: Robert Winningham [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 9:46 AM
To: [EMAIL PROTECTED]
Subject: IllegalStateException in releasePageContext


I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now
receiving many errors in my error log (one for each time a user hits a
.jsp page.)  This is causing my logs to grow VERY quickly.  I did not
receive these types of errors in 3.2.x.  The errors are all in the
following format:

2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.getWriter
(ResponseFacade.java:159) (pc 11)
at org.apache.jasper.runtime.JspWriterImpl.initOut
(JspWriterImpl.java:166) (pc 12)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer
(JspWriterImpl.java:158) (pc 39)
at org.apache.jasper.runtime.JspWriterImpl.flush
(JspWriterImpl.java:205) (pc 8)
at org.apache.jasper.runtime.PageContextImpl.release
(PageContextImpl.java:176) (pc 24)
at
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext
(JspFactoryImpl.java:198) (pc 1)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext
(JspFactoryImpl.java:193) (pc 32)
at org.apache.jsp.eppersonal$jsp._jspService
(eppersonal$jsp.java:270) (pc 1207)
at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:107) (pc 3)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:199) (pc 33)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:382) (pc 60)
at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:474) (pc 326)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247) (pc 248)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193) (pc 98)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243) (pc 352)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:201) (pc 261)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246) (pc 48)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2344) (pc 26)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:164) (pc 99)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:462) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:163) (pc 92)
at org.apache.catalina.core.StandardPipeline.invokeNext

RE: IllegalStateException in releasePageContext

2002-01-25 Thread Robert Winningham
(HttpProcessor.java:1106) (pc 14)
at java.lang.Thread.run  (Thread.java:484)   (pc 11)


Here's a code snippet where the error is occurring...

} catch (Throwable t) {
if (out != null  out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
 Line 75if (_jspxFactory != null)
_jspxFactory.releasePageContext(pageContext); 
}

-Original Message-
From: Wagoner, Mark [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 8:56 AM
To: 'Tomcat Users List'
Subject: RE: IllegalStateException in releasePageContext


Do you happen to have include directives with flush=true.  If so, take
the
flush attribute out.  This helped me, anyway.

-Original Message-
From: Robert Winningham [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 9:46 AM
To: [EMAIL PROTECTED]
Subject: IllegalStateException in releasePageContext


I have upgraded from Tomcat 3.2.2 to Tomcat 4.0.1, and I am now
receiving many errors in my error log (one for each time a user hits a
.jsp page.)  This is causing my logs to grow VERY quickly.  I did not
receive these types of errors in 3.2.x.  The errors are all in the
following format:

2002-01-25 08:07:55 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.lang.IllegalStateException
at org.apache.catalina.connector.ResponseFacade.getWriter
(ResponseFacade.java:159) (pc 11)
at org.apache.jasper.runtime.JspWriterImpl.initOut
(JspWriterImpl.java:166) (pc 12)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer
(JspWriterImpl.java:158) (pc 39)
at org.apache.jasper.runtime.JspWriterImpl.flush
(JspWriterImpl.java:205) (pc 8)
at org.apache.jasper.runtime.PageContextImpl.release
(PageContextImpl.java:176) (pc 24)
at
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext
(JspFactoryImpl.java:198) (pc 1)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext
(JspFactoryImpl.java:193) (pc 32)
at org.apache.jsp.eppersonal$jsp._jspService
(eppersonal$jsp.java:270) (pc 1207)
at org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:107) (pc 3)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
(JspServlet.java:199) (pc 33)
at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:382) (pc 60)
at org.apache.jasper.servlet.JspServlet.service
(JspServlet.java:474) (pc 326)
at
javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest,java
x.servlet.ServletResponse) (HttpServlet.java:853) (pc 30)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247) (pc 248)
at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193) (pc 98)
at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243) (pc 352)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:201) (pc 261)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.CertificatesValve.invoke
(CertificatesValve.java:246) (pc 48)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18)
at org.apache.catalina.core.ContainerBase.invoke
(ContainerBase.java:943) (pc 6)
at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2344) (pc 26)
at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:164) (pc 99)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566) (pc 87)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:462) (pc 3)
at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564) (pc 55)
at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472) (pc 18

Re: IllegalStateException on jsp:include in simple jsp page

2001-09-30 Thread Remy Maucherat

 This simple tst.jsp page:

 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
 html
 head
  titleTst.jsp/title
  link rel=stylesheet type=text/css href=tst.css 
  jsp:include page=tst.js flush=true /
 /head

 body
 h1Tst.jsp is OK!/h1
 /body
 /html

 is producing an IllegalStateException on the inclusion of the tst.js file
 when using
 the current jakarta-tomcat-4.0 binary release. The same tst.jsp file works
 fine
 when using the jakarta-tomcat-3.2.3 release. I don't see that I have much
 control
 preventing the call to obtain the request output stream so how do I
prevent
 this
 error, and is this valid behavior? The full exception is given below as
well
 as the tst.css and tst.js files.

The behavior is valid, but is easy to fix.
Here, the JSP page uses a writer. Since the static page server is also a
servlet, it can't use an output stream to output the data (you'll get that
ISE if you call getOutputStream()). It will attempt to use the writer in
that particular case, but only if the file being included is a text file
(it's the case here, but there's no MIME type for .js).
The test used is that the MIME type of the included file has to be starting
with text.

Adding the following mapping in your web.xml should make it work:
  mime-mapping
extensionjs/extension
mime-typetext/plain/mime-type
  /mime-mapping

Remy




RE: IllegalStateException - tomcat 4

2001-02-15 Thread Michael Wentzel

 I have searched archives and have seen similar discussions, 
 but could not
 really find an answer.
 I am developing a software on top of Servlet API 2.3 so I do 
 need to use
 Tomcat at least for now. I tried to create a very simplified 
 test case. I
 was able to reproduce a part of the problem so far, so that I can move
 forward.
 I am getting the following exception:
 
 java.lang.IllegalStateException: Cannot forward after 
 response has been
 committed
   at

This is from a forward being used after output has already been
written to the JSPWriter.


---
Michael Wentzel
Software Developer
Software As We Think - http://www.aswethink.com
mailto:[EMAIL PROTECTED]

- Punisher of those who cannot spell dumb!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: IllegalStateException - tomcat 4

2001-02-15 Thread Andrey Akselrod

But this is the trick: I am not using forward - i use include!
(see my last email for the code sample).
-a

 -Original Message-
 From: Michael Wentzel [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 15, 2001 11:11 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: IllegalStateException - tomcat 4
 
 
  I have searched archives and have seen similar discussions, 
  but could not
  really find an answer.
  I am developing a software on top of Servlet API 2.3 so I do 
  need to use
  Tomcat at least for now. I tried to create a very simplified 
  test case. I
  was able to reproduce a part of the problem so far, so that I can move
  forward.
  I am getting the following exception:
  
  java.lang.IllegalStateException: Cannot forward after 
  response has been
  committed
  at
 
 This is from a forward being used after output has already been
 written to the JSPWriter.
 
 
 ---
 Michael Wentzel
 Software Developer
 Software As We Think - http://www.aswethink.com
 mailto:[EMAIL PROTECTED]
 
 - Punisher of those who cannot spell dumb!
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: IllegalStateException - tomcat 4

2001-02-15 Thread Michael Wentzel

  I have searched archives and have seen similar discussions, 
 but could not
  really find an answer.
  I am developing a software on top of Servlet API 2.3 so I 
 do need to use
  Tomcat at least for now. I tried to create a very 
 simplified test case. I
  was able to reproduce a part of the problem so far, so that 
 I can move
  forward.
  I am getting the following exception:
 
  java.lang.IllegalStateException: Cannot forward after 
 response has been
  committed
  at
  org.apache.catalina.core.ApplicationDispatcher.doForward(Applicati
  onDispatch
  er.java:245)
  at
  org.apache.catalina.core.ApplicationDispatcher.forward(Application
  Dispatcher
  .java:236)
  at
  org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerSe
  rvlet.java
  :386)
  at
  
 org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServl
 et.java:144)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
  org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationD
  ispatcher.
  java:573)
  at
  org.apache.catalina.core.ApplicationDispatcher.doInclude(Applicati
  onDispatch
  er.java:483)
  ...

This is the stack level that seems to initiate the problem.  The call to
ApplicationDispatcher.doInclude ends up calling the
InvokerServlet.serveRequest.
If you take a look at the serveRequest method source it passes the request
to RequestDispatcher.forward and here in lies the problem and the source of
the call to doForward(this doesn't seem right to me).

 I read the spec - it says that there are limitations with "forward", but
 "include" should be just fine.

Is this the Catalina specs specifically or Servlet specs(if so which version
of servlet specs)?

If you're interested here's the path to the relevant classes:

TOMCAT_HOME/src/catalina/src/share/org/apache/catalina/servlets/InvokerServl
et.java
TOMCAT_HOME/src/catalina/src/share/org/apache/catalina/core/ApplicationDispa
tcher.java


Sorry this doesn't give you much help in fixing your problem but maybe at
least it
will be a starting point.

---
Michael Wentzel
Software Developer
Software As We Think - http://www.aswethink.com
mailto:[EMAIL PROTECTED]

- Punisher of those who cannot spell dumb!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: IllegalStateException - tomcat 4

2001-02-15 Thread Andrey Akselrod

Craig, Michael,

thank you for your help!

Craig, your last email explained everything - thank you. I am a lot less
stressed now :) I have a few questions though.

Instead of mapping each servlet I just removed /servlet/* invoker mapping.
It worked after that. Is it safe to do so? What does the invoker do?
I took a look at the source code - and realized that you wrote it! Thanks
for taking your time to explain it all...
Anyway, why do you forward instead of include in there? How come Tomcat
works without this association (/servlet/*)?

Thank you again,
-a


 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 15, 2001 2:30 PM
 To: [EMAIL PROTECTED]
 Subject: Re: IllegalStateException - tomcat 4


 The reason you are getting the exeption is that the invoker
 servlet (the one mapped to
 "/servlet/*" does a RequestDispatcher.forward() to call the
 actual servlet class.
 Thus, you are getting the error because you did the flush() in
 the JSP page before
 calling.  NOTE:  The existence of an invoker servlet is a Tomcat
 feature, and is not
 part of the spec, so there are no rules about how they work.

 To avoid this problem, you should set up a servlet-mapping
 entry in your web.xml file
 so that you can do a request dispatcher directly to your servlet
 itself.  For example,
 if you have the following entries in web.xml:

 servlet
 servlet-nameMyServlet/servlet-name
 servlet-classincludetest.secondservlet/servlet-class
 /servlet

 servlet-mapping
 servlet-nameMyServlet/servlet-name
 url-pattern/include-test/url-pattern
 /servlet-mapping

 Then you can call your dispatcher like this:

 %
 out.flush();
 RequestDispatcher rd =
 request.getRequestDispatcher("/include-test");
 rd.include(request, response);
 %

 or, even simpler:

 jsp:include page="/include-test" flush="true"/

 Craig McClanahan

 PS:  Removing the flush() in your calling page would also make
 the original example
 work correctly :-).




 Andrey Akselrod wrote:

  Hello,
 
  I have searched archives and have seen similar discussions, but
 could not
  really find an answer.
  I am developing a software on top of Servlet API 2.3 so I do need to use
  Tomcat at least for now. I tried to create a very simplified
 test case. I
  was able to reproduce a part of the problem so far, so that I can move
  forward.
  I am getting the following exception:
 
  java.lang.IllegalStateException: Cannot forward after response has been
  committed
  at
 
 org.apache.catalina.core.ApplicationDispatcher.doForward(Applicati
 onDispatch
  er.java:245)
  at
 
 org.apache.catalina.core.ApplicationDispatcher.forward(Application
 Dispatcher
  .java:236)
  at
 
 org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerSe
 rvlet.java
  :386)
  at
 
 org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 
 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationD
 ispatcher.
  java:573)
  at
 
 org.apache.catalina.core.ApplicationDispatcher.doInclude(Applicati
 onDispatch
  er.java:483)
  at
 
 org.apache.catalina.core.ApplicationDispatcher.include(Application
 Dispatcher
  .java:388)
  at
 
 _0002ffirst_0002ejspfirst_jsp_28._jspService(_0002ffirst_0002ejspf
 irst_jsp_2
  8.java:57)
  at
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 
 org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Jsp
 Servlet.ja
  va:184)
  at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:328)
  at
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:407)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati
 onFilterCh
  ain.java:215)
  at
 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp
 erValve.ja
  va:251)
  at
 org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 
 org.apache.catalina.core.StandardContextValve.invoke(StandardConte
 xtValve.ja
  va:196)
  at
 org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:977)
  at
 
 org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2041)
  at
 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv
 e.java:161
  )
  at
 org.apache.catalina.valves.ValveBase.invokeNext(ValveBase.java:242)
  at
 
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:414)
  at
 org.apache.catalina.core

Re: IllegalStateException - tomcat 4

2001-02-15 Thread Craig R. McClanahan

Andrey Akselrod wrote:

 Craig, Michael,

 thank you for your help!

 Craig, your last email explained everything - thank you. I am a lot less
 stressed now :) I have a few questions though.

 Instead of mapping each servlet I just removed /servlet/* invoker mapping.

From where did you remove it?  If you removed it from the
$CATALINA_HOME/conf/web.xml file, you should have broken "invoker" service for
all of the webapps -- in other words, JSP pages would still work and servlets
explicitly mapped would still work, but anything accessed by /servlet/x
would now return 404s.

If you don't have any /servlet/x URIs, then there will be no harm in
removing this mapping.


 It worked after that. Is it safe to do so? What does the invoker do?

The invoker, umm, err, invokes servlets :-)

Actually, it is there to emulate the hard-coded behavior of servlet containers
that existed prior to the development of web applications in the 2.2 spec.  The
invoker looks at the path info (after the "/servlet" path that is mapped to
itself), and tries to find either a servlet with that name, or a Java class with
that name, and then executes that as a servlet.  In effect, it lets you register
servlets without defining them in the web.xml file.


 I took a look at the source code - and realized that you wrote it!

A pretty large majority of the servlet container code in Tomcat 4.0 (as opposed
to the JSP stuff) is my original code, but there have been tons of important
contributions from others as well.

 Thanks
 for taking your time to explain it all...
 Anyway, why do you forward instead of include in there?

If we used include, the invoked servlet would not be able to set response
headers or cookies -- see the servlet spec for details.  That would be decidedly
unuseful.

 How come Tomcat
 works without this association (/servlet/*)?


Tomcat 3.1 used an invoker servlet mapped to "/servlet/*" in the global web.xml
file, exactly as Tomcat 4.0 does.  Tomcat 3.2 arbitrarily changed the way this
is configured (not my idea, but that's a different story) to a request
interceptor that accomplishes essentially the same task, but without using a
servlet to perform the invoking.

But I do feel compelled to warn you one more time -- web apps that depend on the
invoker functionality are *NOT* guaranteed to be portable to other servlet
containers (support for this is common, but is not required by the servlet
specification).  Web apps that use explicit servlet mappings are.


 Thank you again,
 -a


Craig



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: IllegalStateException - tomcat 4

2001-02-15 Thread Andrey Akselrod

Ok - everything is as clear as it can ever be.
/servlet/* association is back and will stay. I guess the only side effect
is that I have to register all of my servlets - I include all of them from
jsp.
That is a small price to pay. I am glad I got my sanity back :)

Craig - you are the best - thank you.

-a

 -Original Message-
 From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 15, 2001 4:40 PM
 To: [EMAIL PROTECTED]
 Subject: Re: IllegalStateException - tomcat 4


 Andrey Akselrod wrote:

  Craig, Michael,
 
  thank you for your help!
 
  Craig, your last email explained everything - thank you. I am a lot less
  stressed now :) I have a few questions though.
 
  Instead of mapping each servlet I just removed /servlet/*
 invoker mapping.

 From where did you remove it?  If you removed it from the
 $CATALINA_HOME/conf/web.xml file, you should have broken
 "invoker" service for
 all of the webapps -- in other words, JSP pages would still work
 and servlets
 explicitly mapped would still work, but anything accessed by
 /servlet/x
 would now return 404s.

 If you don't have any /servlet/x URIs, then there will be no harm in
 removing this mapping.

 
  It worked after that. Is it safe to do so? What does the invoker do?

 The invoker, umm, err, invokes servlets :-)

 Actually, it is there to emulate the hard-coded behavior of
 servlet containers
 that existed prior to the development of web applications in the
 2.2 spec.  The
 invoker looks at the path info (after the "/servlet" path that is
 mapped to
 itself), and tries to find either a servlet with that name, or a
 Java class with
 that name, and then executes that as a servlet.  In effect, it
 lets you register
 servlets without defining them in the web.xml file.

 
  I took a look at the source code - and realized that you wrote it!

 A pretty large majority of the servlet container code in Tomcat
 4.0 (as opposed
 to the JSP stuff) is my original code, but there have been tons
 of important
 contributions from others as well.

  Thanks
  for taking your time to explain it all...
  Anyway, why do you forward instead of include in there?

 If we used include, the invoked servlet would not be able to set response
 headers or cookies -- see the servlet spec for details.  That
 would be decidedly
 unuseful.

  How come Tomcat
  works without this association (/servlet/*)?
 

 Tomcat 3.1 used an invoker servlet mapped to "/servlet/*" in the
 global web.xml
 file, exactly as Tomcat 4.0 does.  Tomcat 3.2 arbitrarily changed
 the way this
 is configured (not my idea, but that's a different story) to a request
 interceptor that accomplishes essentially the same task, but
 without using a
 servlet to perform the invoking.

 But I do feel compelled to warn you one more time -- web apps
 that depend on the
 invoker functionality are *NOT* guaranteed to be portable to other servlet
 containers (support for this is common, but is not required by the servlet
 specification).  Web apps that use explicit servlet mappings are.

 
  Thank you again,
  -a
 

 Craig



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: IllegalStateException on index.html??

2001-02-07 Thread Kyle Robinson
Title: IllegalStateException on index.html??



I 
occasionally get this error when I recompile a class that Tomcat is using. 
After you recompile all your classes you should restart 
Tomcat.

  -Original Message-From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]Sent: Wednesday, February 07, 
  2001 9:42 AMTo: [EMAIL PROTECTED]Subject: 
  IllegalStateException on index.html??
  Error: 500 Location: 
  /partners/index.html Internal Servlet Error: 
  
  java.lang.IllegalStateException: Can't happen - classname is 
  null, who added this ?  
  at 
  org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:261) 
   at 
  org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289) 
   at 
  org.apache.tomcat.core.Handler.service(Handler.java:254) 
   at 
  org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) 
   at 
  org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) 
   at 
  org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) 
   at 
  org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection(Ajp13ConnectionHandler.java:160)
   at 
  org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) 
   at 
  org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) 
   at 
  java.lang.Thread.run(Thread.java:484) 
  It's a very simple html page. Obviously it references no 
  classes. Why am I getting this error? I've been using Tomcat for a few weeks 
  now and this is the first time I've seen this. Restart Tomcat and I get the 
  page just fine. Another oddity that happened to me yesterday was all of a 
  sudden I was getting "Forbidden" errors on my HTML pages. In that case I only 
  had to restart Apache. I'm using Tomcat 3.2, Apache 1.3.14, on Solaris 
  2.6.
  -Sean 
  P.S. Sorry for the duplicate. 



Re: IllegalStateException on index.html??

2001-02-07 Thread joshua


Just restart tomcat. I usually get that when I do to much refreshing.

[EMAIL PROTECTED] wrote:

Error: 500
Location: /partners/index.html
Internal Servlet Error:
java.lang.IllegalStateException: Can't happen - classname
is null, who added this ?
 at org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java:261)
 at org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:289)
 at org.apache.tomcat.core.Handler.service(Handler.java:254)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
 at org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection(Ajp13ConnectionHandler.java:160)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
 at java.lang.Thread.run(Thread.java:484)
It's a very simple html page. Obviously it references
no classes. Why am I getting this error? I've been using Tomcat for a few
weeks now and this is the first time I've seen this. Restart Tomcat and
I get the page just fine. Another oddity that happened to me yesterday
was all of a sudden I was getting "Forbidden" errors on my HTML pages.
In that case I only had to restart Apache. I'm using Tomcat 3.2, Apache
1.3.14, on Solaris 2.6.
-Sean
P.S. Sorry for the duplicate.



RE: IllegalStateException: Short Read while trying to do forward()

2001-01-09 Thread Tal Dayan

It seems that the problem is related to package javax.servlet.http.HttpUtils
which is deprecated.

Are you using HttpUtils.parsePostData() ?

When I added a call to this method to a working servlet (Tomcat 3.2.1), the
servlet generated a 'read short' excpetion when trying to forward the call
to the JSP. When removed the call to the method, the servlet worked again. I
presuem the right way to get the parameters are thrugh the request API but I
have not tried it yet.

Tal




 -Original Message-
 From: Jason C Jones [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 19, 2000 9:09 AM
 To: [EMAIL PROTECTED]
 Subject: IllegalStateException: Short Read while trying to do forward()


 I am running 3.2.1 in standalone mode and when I try to do a
 forward with a
 RequestDispatcher I get the following error:

 going to /patient.jsp
 res.isCommitted() = false
 res.getBufferSize() = 8192
 2000-12-19 04:53:48 - Ctx( /nativeweb ): Exception in:

 /nativeweb + /patient.
 jsp + null) - java.lang.IllegalArgumentException: Short Read
 at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:238)
 at
 org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)


 Note the two debugging lines above the exception.  According to
 the specs, an
 IllegalArgumentException is thrown when the response is already
 committed,
 which it is not as you can see.

 Is this a bug?  The servlet in question uses
 HttpUtil.parsePostData to read the
 post data and inflate a bean.  It then puts the bean into the
 session object
 and tries to redirect to a jsp for display.

 Anyone have any ideas?

 Thanks,

 Jason


 ---
 Jason C. Jones
 [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: IllegalStateException???

2001-01-05 Thread Matt Goss

no, the cmd is being displayed... that's the thing that I don't understand, the
page comes up and everthing displays fine. Under tomcat 3.1 the error message is
displayed at the bottom of the page, and under 3.2 it comes up on the server's
display, but other than that, everything works fine... very confusing...
Matt

Kitching Simon wrote:

 Hmm .. looks ok to me..

 On to theory # 2 :-)

 Is the %= request.getParameter("cmd") % perhaps throwing an
 exception (due to null being returned)? It might be that exception-
 catching code (that tomcat auto-inserts when generating .jsp - .java)
 is trying to do a redirect to an error page...I've had problems with this
 before.

 Why not try putting
 %
  String cmd = "oops";
   try
 {
   cmd = request.getParameter("cmd");
 }
 catch(Throwable t)
 {
 }
 %

 at the top of your page, then using
 %= cmd % instead of %= request.getParameter("cmd") % ??

 This should let you know if theory #2 flies or dies :-)

 Cheers,

 Simon

  -Original Message-
  From: Matt Goss [SMTP:[EMAIL PROTECTED]]
  Sent: Thursday, January 04, 2001 7:22 PM
  To:   [EMAIL PROTECTED]
  Subject:  Re: IllegalStateException???
 
  The servlet that gets posted to performs some business logic via JavaBeans
  and then
  forwards to the display page (in this case, the confirm.jsp) it never gets
  the output
  stream and it doesn't include any other jsp's.
  sample code
  //save the changes and then send to confirm page
  Customer tmpcust =
  (Customer)req.getSession(false).getAttribute("tmpcust");
  try{
  logger.log("removing customer:"+tmpcust.getId(),
  logger.INFO);
  this.clist.removeCustomer(tmpcust.getId());
  logger.log("customer removed", logger.INFO);
  }catch(Exception E){
  logger.log(E, "error removing customer",
  logger.ERROR);
  req.setAttribute("msg", "error removing customer,
  check logs");
 
  this.send(req, resp,
  this.props.getProperty("error"),
  "editcustomer");
  return;
  }
  this.send(req, resp,
  this.props.getProperty("confirm"),
  "editcustomer");
  //snip
  public void send(HttpServletRequest req, HttpServletResponse resp, String
  page, String
  component) throws IOException, ServletException
  {
  RequestDispatcher rd =
  req.getRequestDispatcher("/"+component+"/"+page);
  rd.forward(req, resp);
  }
  /sample code
  ??? any clue?
  Matt
 
  Kitching Simon wrote:
 
   According to the sun servlet specs, you are **not allowed** to
   do a forward operation after having called a method to get the
   output stream, exactly as the message states.
  
   Are you sure you have never obtained an output stream
   before attempting to forward to "confirm.jsp" ??
  
   If you have something like
 posted data -- servlet1
 servlet1 does "include" for "handle-data.jsp"
 servlet1 does "forward" to "confirm.jsp"
   then if handle-data.jsp obtains an output stream, this would
   exactly explain the problem.
  
   I suspect that the first thing *any* jsp page does is grab the
   output stream, have a look at the generated jsp code for
   "handle-data.jsp" or whatever your equivalent is.
  
   If your situation is different from what I have guessed, then
   please include more information in your next post - the page
   you included here looks ok, so the problem is probably in the
   upstream processing you didn't give any info about!
  
   Cheers,
  
   Simon
  
-Original Message-
From: Matt Goss [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, January 04, 2001 4:23 PM
To:   [EMAIL PROTECTED]
Subject:  IllegalStateException???
   
Hi everyone,
I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN
  3.0.
The application consists of servlets that accept form posts from
  JSP's,
they process the data and then forward to other jsp pages. When I
forward to a specific page, the page displays fine, but I'm getting an
error message on my server screen :
error message
2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
/rollout +/editcomponent/confirm.jsp + null) Cannot forward as
OutputStream or Writer has already been obtained
/error message
the page is a simple confirmation page and looks like this:
jsp page
html
head
titleCUSTOMER OPERATION CONFIRMATION/title
DEFANGED_meta http-equiv="Content-Type" content="text/html;
  charset=iso-8859-1"
   
/head
body bgcolor="#FF"
h1The %=request

RE: IllegalStateException???

2001-01-04 Thread Kitching Simon

According to the sun servlet specs, you are **not allowed** to
do a forward operation after having called a method to get the
output stream, exactly as the message states.

Are you sure you have never obtained an output stream
before attempting to forward to "confirm.jsp" ??

If you have something like
  posted data -- servlet1
  servlet1 does "include" for "handle-data.jsp"
  servlet1 does "forward" to "confirm.jsp"
then if handle-data.jsp obtains an output stream, this would
exactly explain the problem.

I suspect that the first thing *any* jsp page does is grab the
output stream, have a look at the generated jsp code for
"handle-data.jsp" or whatever your equivalent is.

If your situation is different from what I have guessed, then
please include more information in your next post - the page
you included here looks ok, so the problem is probably in the
upstream processing you didn't give any info about!

Cheers,

Simon

 -Original Message-
 From: Matt Goss [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 4:23 PM
 To:   [EMAIL PROTECTED]
 Subject:  IllegalStateException???
 
 Hi everyone,
 I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN 3.0.
 The application consists of servlets that accept form posts from JSP's,
 they process the data and then forward to other jsp pages. When I
 forward to a specific page, the page displays fine, but I'm getting an
 error message on my server screen :
 error message
 2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
 /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
 OutputStream or Writer has already been obtained
 /error message
 the page is a simple confirmation page and looks like this:
 jsp page
 html
 head
 titleCUSTOMER OPERATION CONFIRMATION/title
 meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
 
 /head
 body bgcolor="#FF"
 h1The %=request.getParameter("cmd")% operation was successful!
 :)/h1
 a href="doeditcustomer.html"Return to the Customer list/abr
 a href="index.jsp"Return to navigation page/a
 /body
 /html
 /jsp page
 
 does anyone have any idea what could be causing this???
 Matt Goss  File: Card for Matt GossFile: ATT17765.txt  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: IllegalStateException???

2001-01-04 Thread Ingo Luetkebohle

On Thu, Jan 04, 2001 at 10:23:13AM -0500, Matt Goss wrote:
 I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN 3.0.
 The application consists of servlets that accept form posts from JSP's,
 they process the data and then forward to other jsp pages. When I
 forward to a specific page, the page displays fine, but I'm getting an
 error message on my server screen :

What does the code of the forwarding page look like?

The error message sounds as if you had already printed some
content. Because forwarding is an HTTP-Header operation, it needs to
be done before any content is sent. The reason is works nonetheless
could be the page caching Tomcat performs. Strange, but check it out.

Ingo

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: IllegalStateException???

2001-01-04 Thread Matt Goss

The servlet that gets posted to performs some business logic via JavaBeans and then
forwards to the display page (in this case, the confirm.jsp) it never gets the output
stream and it doesn't include any other jsp's.
sample code
//save the changes and then send to confirm page
Customer tmpcust =
(Customer)req.getSession(false).getAttribute("tmpcust");
try{
logger.log("removing customer:"+tmpcust.getId(), logger.INFO);
this.clist.removeCustomer(tmpcust.getId());
logger.log("customer removed", logger.INFO);
}catch(Exception E){
logger.log(E, "error removing customer", logger.ERROR);
req.setAttribute("msg", "error removing customer, check logs");

this.send(req, resp, this.props.getProperty("error"),
"editcustomer");
return;
}
this.send(req, resp, this.props.getProperty("confirm"),
"editcustomer");
//snip
public void send(HttpServletRequest req, HttpServletResponse resp, String page, String
component) throws IOException, ServletException
{
RequestDispatcher rd = req.getRequestDispatcher("/"+component+"/"+page);
rd.forward(req, resp);
}
/sample code
??? any clue?
Matt

Kitching Simon wrote:

 According to the sun servlet specs, you are **not allowed** to
 do a forward operation after having called a method to get the
 output stream, exactly as the message states.

 Are you sure you have never obtained an output stream
 before attempting to forward to "confirm.jsp" ??

 If you have something like
   posted data -- servlet1
   servlet1 does "include" for "handle-data.jsp"
   servlet1 does "forward" to "confirm.jsp"
 then if handle-data.jsp obtains an output stream, this would
 exactly explain the problem.

 I suspect that the first thing *any* jsp page does is grab the
 output stream, have a look at the generated jsp code for
 "handle-data.jsp" or whatever your equivalent is.

 If your situation is different from what I have guessed, then
 please include more information in your next post - the page
 you included here looks ok, so the problem is probably in the
 upstream processing you didn't give any info about!

 Cheers,

 Simon

  -Original Message-
  From: Matt Goss [SMTP:[EMAIL PROTECTED]]
  Sent: Thursday, January 04, 2001 4:23 PM
  To:   [EMAIL PROTECTED]
  Subject:  IllegalStateException???
 
  Hi everyone,
  I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN 3.0.
  The application consists of servlets that accept form posts from JSP's,
  they process the data and then forward to other jsp pages. When I
  forward to a specific page, the page displays fine, but I'm getting an
  error message on my server screen :
  error message
  2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
  /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
  OutputStream or Writer has already been obtained
  /error message
  the page is a simple confirmation page and looks like this:
  jsp page
  html
  head
  titleCUSTOMER OPERATION CONFIRMATION/title
  DEFANGED_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
 
  /head
  body bgcolor="#FF"
  h1The %=request.getParameter("cmd")% operation was successful!
  :)/h1
  a href="doeditcustomer.html"Return to the Customer list/abr
  a href="index.jsp"Return to navigation page/a
  /body
  /html
  /jsp page
 
  does anyone have any idea what could be causing this???
  Matt Goss  File: Card for Matt GossFile: ATT17765.txt 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]


begin:vcard 
n:Goss;Matt
tel;fax:919-657-1501
tel;work:919-657-1432
x-mozilla-html:FALSE
url:www.rtci.com
org:RTCI;Custom Solutions
adr:;;201 Shannon Oaks Circle;Cary;NC;27511;US
version:2.1
email;internet:[EMAIL PROTECTED]
title:Web Developer
fn:Matt
end:vcard



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


RE: IllegalStateException???

2001-01-04 Thread Kitching Simon

Hmm .. looks ok to me..

On to theory # 2 :-)

Is the %= request.getParameter("cmd") % perhaps throwing an
exception (due to null being returned)? It might be that exception-
catching code (that tomcat auto-inserts when generating .jsp - .java)
is trying to do a redirect to an error page...I've had problems with this
before.

Why not try putting
%
 String cmd = "oops";
  try
{
  cmd = request.getParameter("cmd");
}
catch(Throwable t)
{
}
%

at the top of your page, then using
%= cmd % instead of %= request.getParameter("cmd") % ??

This should let you know if theory #2 flies or dies :-)

Cheers,

Simon

 -Original Message-
 From: Matt Goss [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 04, 2001 7:22 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: IllegalStateException???
 
 The servlet that gets posted to performs some business logic via JavaBeans
 and then
 forwards to the display page (in this case, the confirm.jsp) it never gets
 the output
 stream and it doesn't include any other jsp's.
 sample code
 //save the changes and then send to confirm page
 Customer tmpcust =
 (Customer)req.getSession(false).getAttribute("tmpcust");
 try{
 logger.log("removing customer:"+tmpcust.getId(),
 logger.INFO);
 this.clist.removeCustomer(tmpcust.getId());
 logger.log("customer removed", logger.INFO);
 }catch(Exception E){
 logger.log(E, "error removing customer",
 logger.ERROR);
 req.setAttribute("msg", "error removing customer,
 check logs");
 
 this.send(req, resp,
 this.props.getProperty("error"),
 "editcustomer");
 return;
 }
 this.send(req, resp,
 this.props.getProperty("confirm"),
 "editcustomer");
 //snip
 public void send(HttpServletRequest req, HttpServletResponse resp, String
 page, String
 component) throws IOException, ServletException
 {
 RequestDispatcher rd =
 req.getRequestDispatcher("/"+component+"/"+page);
 rd.forward(req, resp);
 }
 /sample code
 ??? any clue?
 Matt
 
 Kitching Simon wrote:
 
  According to the sun servlet specs, you are **not allowed** to
  do a forward operation after having called a method to get the
  output stream, exactly as the message states.
 
  Are you sure you have never obtained an output stream
  before attempting to forward to "confirm.jsp" ??
 
  If you have something like
posted data -- servlet1
servlet1 does "include" for "handle-data.jsp"
servlet1 does "forward" to "confirm.jsp"
  then if handle-data.jsp obtains an output stream, this would
  exactly explain the problem.
 
  I suspect that the first thing *any* jsp page does is grab the
  output stream, have a look at the generated jsp code for
  "handle-data.jsp" or whatever your equivalent is.
 
  If your situation is different from what I have guessed, then
  please include more information in your next post - the page
  you included here looks ok, so the problem is probably in the
  upstream processing you didn't give any info about!
 
  Cheers,
 
  Simon
 
   -Original Message-
   From: Matt Goss [SMTP:[EMAIL PROTECTED]]
   Sent: Thursday, January 04, 2001 4:23 PM
   To:   [EMAIL PROTECTED]
   Subject:  IllegalStateException???
  
   Hi everyone,
   I just ported an applicaiton onto tomcat 3.2 that ran fine on JRUN
 3.0.
   The application consists of servlets that accept form posts from
 JSP's,
   they process the data and then forward to other jsp pages. When I
   forward to a specific page, the page displays fine, but I'm getting an
   error message on my server screen :
   error message
   2001-01-04 09:53:05 - Ctx( /rollout ):IllegalStateException in: R(
   /rollout +/editcomponent/confirm.jsp + null) Cannot forward as
   OutputStream or Writer has already been obtained
   /error message
   the page is a simple confirmation page and looks like this:
   jsp page
   html
   head
   titleCUSTOMER OPERATION CONFIRMATION/title
   DEFANGED_meta http-equiv="Content-Type" content="text/html;
 charset=iso-8859-1"
  
   /head
   body bgcolor="#FF"
   h1The %=request.getParameter("cmd")% operation was successful!
   :)/h1
   a href="doeditcustomer.html"Return to the Customer list/abr
   a href="index.jsp"Return to navigation page/a
   /body
   /html
   /jsp page
  
   does anyone have any idea what could be causing this???
   Matt Goss  File: Card for Matt GossFile: ATT17765.txt 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, email: [EMAIL PROTECTED] 
 File: Card for Matt GossFile: ATT19241.txt  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: IllegalStateException: Short Read while trying to do forward()

2000-12-20 Thread Stephen Coy

G'Day,

on 20/12/00 4:08 AM, Jason C Jones at [EMAIL PROTECTED] wrote:

 I am running 3.2.1 in standalone mode and when I try to do a forward with a
 RequestDispatcher I get the following error:
 
 going to /patient.jsp
 res.isCommitted() = false
 res.getBufferSize() = 8192
 2000-12-19 04:53:48 - Ctx( /nativeweb ): Exception in: R( /nativeweb +
 /patient.
 jsp + null) - java.lang.IllegalArgumentException: Short Read
 at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:238)
 at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)
 
 
 Note the two debugging lines above the exception.  According to the specs, an
 IllegalArgumentException is thrown when the response is already committed,
 which it is not as you can see.
 
 Is this a bug?  The servlet in question uses HttpUtil.parsePostData to read
 the 
 post data and inflate a bean.  It then puts the bean into the session object
 and tries to redirect to a jsp for display.
 
 Anyone have any ideas?
 

I'm going to take a stab at the obvious here (at least to me). You seem to
be confusing the IllegalArgumentException with IllegalStateException. I
don't think that your assertion that "According to the specs, an
IllegalArgumentException is thrown when the response is already committed"
is quite right. I'm pretty sure that it says "Illegal *State* Exception".

I suspect that you are passing a bad argument to your bean inflation code,
and this is causing the "Illegal *Argument* Exception".

Regards,

Steve Coy





RE: IllegalStateException: Short Read while trying to do forward()

2000-12-19 Thread Duane Morse

This is probably the same error I reported a couple of weeks ago, though in
my case
the error was occurring before the servlet container tried compiling a JSP.
My servlet
already processed the POST data, but the servlet container tried to re-read
the data
in preparation to hand the request to the JSP, and there was, of course,
nothing to read.
This is a fundamental problem (since doing the same thing with a GET works),
and I've
not received a response.  I don't have this problem using Allaire's JRun.

-Original Message-
From: Jason C Jones [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 19, 2000 10:09 AM
To: [EMAIL PROTECTED]
Subject: IllegalStateException: Short Read while trying to do forward()


I am running 3.2.1 in standalone mode and when I try to do a forward with a 
RequestDispatcher I get the following error:

going to /patient.jsp
res.isCommitted() = false
res.getBufferSize() = 8192
2000-12-19 04:53:48 - Ctx( /nativeweb ): Exception in: R( /nativeweb +
/patient.
jsp + null) - java.lang.IllegalArgumentException: Short Read
at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:238)
at
org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)


Note the two debugging lines above the exception.  According to the specs,
an 
IllegalArgumentException is thrown when the response is already committed, 
which it is not as you can see.

Is this a bug?  The servlet in question uses HttpUtil.parsePostData to read
the 
post data and inflate a bean.  It then puts the bean into the session object

and tries to redirect to a jsp for display.  

Anyone have any ideas?

Thanks,

Jason


---
Jason C. Jones
[EMAIL PROTECTED]