Re: JSP Include error HELP!

2002-09-17 Thread Erick Todd

Ok here is more info.  These pages all work on tomcat 3 right now.  I
have stripped down the page to the bare problem and still get the error.

I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
static include across a symbolic link.  But for this problem of dynamic
including, I have to use jsp:include because the String largeAd actually
comes from a parent page.  But even in this simple situation, nothing
works.   What am I doing wrong, configuration, JVM??

I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
Everything works fine, but I have to be able to pass the string into the
include, so I have to use jsp:include.
Again, this works in all the older tomcats.  I just now upgrade from 3.2
to 4.0.4.

Lastly, I am on redhat linux 7.0 and 7.3

Here is the jsp page.  Down to only 2 lines.
%String  largeAd=/includes/468x60ad.inc;%
jsp:include page=%=largeAd% flush=true/

The contents of /includes.468x60ad.inc are just 5 lines of
html/javascript.

That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
*.jsp.  The server xml for this domain is:
Host name=cscom2.coloradosprings.com
Context path= docBase=/www/sites/cscom/cscom debug=0
reloadable=true 
/Context
   /Host

And finally the stack trace from the log is:

2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.lang.IllegalStateException
at
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
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(ApplicationDispatcher.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
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.java: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(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
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.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
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:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
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:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 

Re: JSP Include error HELP!

2002-09-17 Thread Tim Funk

I can reproduce this - strange. Can you try either of the following:


%String  largeAd=/includes/468x60ad.txt;%
jsp:include page=%=largeAd% flush=true/

OR

 InputStream ps = 
application.getResourceAsStream(/includes/468x60ad.inc);
 if (ps!=null) {
 byte[] buffer = new byte[1024];
 int read = ps.read(buffer);
 while (read0) {
 out.print(new String(buffer, 0, read));
 read = ps.read(buffer);
 }
 ps.close();
 }



Erick Todd wrote:
 Ok here is more info.  These pages all work on tomcat 3 right now.  I
 have stripped down the page to the bare problem and still get the error.
 
 I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
 static include across a symbolic link.  But for this problem of dynamic
 including, I have to use jsp:include because the String largeAd actually
 comes from a parent page.  But even in this simple situation, nothing
 works.   What am I doing wrong, configuration, JVM??
 
 I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
 Everything works fine, but I have to be able to pass the string into the
 include, so I have to use jsp:include.
 Again, this works in all the older tomcats.  I just now upgrade from 3.2
 to 4.0.4.
 
 Lastly, I am on redhat linux 7.0 and 7.3
 
 Here is the jsp page.  Down to only 2 lines.
 %String  largeAd=/includes/468x60ad.inc;%
 jsp:include page=%=largeAd% flush=true/
 
 The contents of /includes.468x60ad.inc are just 5 lines of
 html/javascript.
 
 That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
 *.jsp.  The server xml for this domain is:
   Host name=cscom2.coloradosprings.com
 Context path= docBase=/www/sites/cscom/cscom debug=0
 reloadable=true 
 /Context
/Host
 
 And finally the stack trace from the log is:
 
 2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
 servlet jsp threw exception
 java.lang.IllegalStateException
 at
 
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
 at
 org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
 at
 org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
 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(ApplicationDispatcher.java:683)
 at
 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
 at
 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
 at
 org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
 at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
 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.java: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(ApplicationFilterChain.java:247)
 at
 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
 at
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 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.java:190)
 at
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at
 org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
 at
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 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
 

Re: JSP Include error HELP!

2002-09-17 Thread Erick Todd

The second one works, however it does write a warning to the logs that
the JSPNote javac.main has been depracated.  Do you know why that is? 
So I would say that something is wrong with jsp:include.  However I
really don't want to rewrite every jsp:include across all of my jsp
pages!!

Any idea why the straight include won't work?  Hey I really appreciate
all the help here!!

Or should I consider getting the source, rewriting jsp:include and
re-compile?!?

Erick

On Tue, 2002-09-17 at 10:51, Tim Funk wrote:
 I can reproduce this - strange. Can you try either of the following:
 
 
 %String  largeAd=/includes/468x60ad.txt;%
 jsp:include page=%=largeAd% flush=true/
 
 OR
 
  InputStream ps = 
 application.getResourceAsStream(/includes/468x60ad.inc);
  if (ps!=null) {
  byte[] buffer = new byte[1024];
  int read = ps.read(buffer);
  while (read0) {
  out.print(new String(buffer, 0, read));
  read = ps.read(buffer);
  }
  ps.close();
  }
 
 
 
 Erick Todd wrote:
  Ok here is more info.  These pages all work on tomcat 3 right now.  I
  have stripped down the page to the bare problem and still get the error.
  
  I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
  static include across a symbolic link.  But for this problem of dynamic
  including, I have to use jsp:include because the String largeAd actually
  comes from a parent page.  But even in this simple situation, nothing
  works.   What am I doing wrong, configuration, JVM??
  
  I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
  Everything works fine, but I have to be able to pass the string into the
  include, so I have to use jsp:include.
  Again, this works in all the older tomcats.  I just now upgrade from 3.2
  to 4.0.4.
  
  Lastly, I am on redhat linux 7.0 and 7.3
  
  Here is the jsp page.  Down to only 2 lines.
  %String  largeAd=/includes/468x60ad.inc;%
  jsp:include page=%=largeAd% flush=true/
  
  The contents of /includes.468x60ad.inc are just 5 lines of
  html/javascript.
  
  That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
  *.jsp.  The server xml for this domain is:
  Host name=cscom2.coloradosprings.com
  Context path= docBase=/www/sites/cscom/cscom debug=0
  reloadable=true 
  /Context
 /Host
  
  And finally the stack trace from the log is:
  
  2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
  servlet jsp threw exception
  java.lang.IllegalStateException
  at
  
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
  at
  org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
  at
  org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
  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(ApplicationDispatcher.java:683)
  at
  
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
  at
  
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
  at
  org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
  at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
  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.java: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(ApplicationFilterChain.java:247)
  at
  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
  at
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
  at
  org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
  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.java:190)
  at
  

Re: JSP Include error HELP!

2002-09-17 Thread Erick Todd

Furthermore, I can't just read in the file, because in the real life
situation, it will have jsp code that needs to be executed in it.

-E
On Tue, 2002-09-17 at 11:01, Erick Todd wrote:
 The second one works, however it does write a warning to the logs that
 the JSPNote javac.main has been depracated.  Do you know why that is? 
 So I would say that something is wrong with jsp:include.  However I
 really don't want to rewrite every jsp:include across all of my jsp
 pages!!
 
 Any idea why the straight include won't work?  Hey I really appreciate
 all the help here!!
 
 Or should I consider getting the source, rewriting jsp:include and
 re-compile?!?
 
 Erick
 
 On Tue, 2002-09-17 at 10:51, Tim Funk wrote:
  I can reproduce this - strange. Can you try either of the following:
  
  
  %String  largeAd=/includes/468x60ad.txt;%
  jsp:include page=%=largeAd% flush=true/
  
  OR
  
   InputStream ps = 
  application.getResourceAsStream(/includes/468x60ad.inc);
   if (ps!=null) {
   byte[] buffer = new byte[1024];
   int read = ps.read(buffer);
   while (read0) {
   out.print(new String(buffer, 0, read));
   read = ps.read(buffer);
   }
   ps.close();
   }
  
  
  
  Erick Todd wrote:
   Ok here is more info.  These pages all work on tomcat 3 right now.  I
   have stripped down the page to the bare problem and still get the error.
   
   I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
   static include across a symbolic link.  But for this problem of dynamic
   including, I have to use jsp:include because the String largeAd actually
   comes from a parent page.  But even in this simple situation, nothing
   works.   What am I doing wrong, configuration, JVM??
   
   I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
   Everything works fine, but I have to be able to pass the string into the
   include, so I have to use jsp:include.
   Again, this works in all the older tomcats.  I just now upgrade from 3.2
   to 4.0.4.
   
   Lastly, I am on redhat linux 7.0 and 7.3
   
   Here is the jsp page.  Down to only 2 lines.
   %String  largeAd=/includes/468x60ad.inc;%
   jsp:include page=%=largeAd% flush=true/
   
   The contents of /includes.468x60ad.inc are just 5 lines of
   html/javascript.
   
   That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
   *.jsp.  The server xml for this domain is:
 Host name=cscom2.coloradosprings.com
   Context path= docBase=/www/sites/cscom/cscom debug=0
   reloadable=true 
   /Context
  /Host
   
   And finally the stack trace from the log is:
   
   2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
   servlet jsp threw exception
   java.lang.IllegalStateException
   at
   
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
   at
   
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
   at
   org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
   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(ApplicationDispatcher.java:683)
   at
   
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
   at
   
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
   at
   org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
   at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
   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.java: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(ApplicationFilterChain.java:247)
   at
   
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at
   
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
   at
   org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
   at
   

Re: JSP Include error HELP!

2002-09-17 Thread Tim Funk

I'm not sure about the compile warning.

I think it has to do with mime types needing to be decalred in web.xml.

For example: I have the following pages:
foo.jsp with the contents

hello jsp:include flush='false'  page=foo1.timisastoopidhead/

And the file foo1.timisastoopidhead exists. And voila - I get the wacky 
exception.

BUT if add the following to web.xml:
   mime-mapping
 extensiontimisastoopidhead/extension
 mime-typetext/plain/mime-type
   /mime-mapping

And restart tomcat (not reload, restart) - all is ok.


So the moral of the story seems - register you file extension/mime type 
in web.xml if you want to include it as a file.




Erick Todd wrote:
 The second one works, however it does write a warning to the logs that
 the JSPNote javac.main has been depracated.  Do you know why that is? 
 So I would say that something is wrong with jsp:include.  However I
 really don't want to rewrite every jsp:include across all of my jsp
 pages!!
 
 Any idea why the straight include won't work?  Hey I really appreciate
 all the help here!!
 
 Or should I consider getting the source, rewriting jsp:include and
 re-compile?!?
 
 Erick
 
 On Tue, 2002-09-17 at 10:51, Tim Funk wrote:
 
I can reproduce this - strange. Can you try either of the following:


%String  largeAd=/includes/468x60ad.txt;%
jsp:include page=%=largeAd% flush=true/

OR

 InputStream ps = 
application.getResourceAsStream(/includes/468x60ad.inc);
 if (ps!=null) {
 byte[] buffer = new byte[1024];
 int read = ps.read(buffer);
 while (read0) {
 out.print(new String(buffer, 0, read));
 read = ps.read(buffer);
 }
 ps.close();
 }



Erick Todd wrote:

Ok here is more info.  These pages all work on tomcat 3 right now.  I
have stripped down the page to the bare problem and still get the error.

I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
static include across a symbolic link.  But for this problem of dynamic
including, I have to use jsp:include because the String largeAd actually
comes from a parent page.  But even in this simple situation, nothing
works.   What am I doing wrong, configuration, JVM??

I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
Everything works fine, but I have to be able to pass the string into the
include, so I have to use jsp:include.
Again, this works in all the older tomcats.  I just now upgrade from 3.2
to 4.0.4.

Lastly, I am on redhat linux 7.0 and 7.3

Here is the jsp page.  Down to only 2 lines.
%String  largeAd=/includes/468x60ad.inc;%
jsp:include page=%=largeAd% flush=true/

The contents of /includes.468x60ad.inc are just 5 lines of
html/javascript.

That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
*.jsp.  The server xml for this domain is:
 Host name=cscom2.coloradosprings.com
Context path= docBase=/www/sites/cscom/cscom debug=0
reloadable=true 
/Context
   /Host

And finally the stack trace from the log is:

2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.lang.IllegalStateException
at
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
at
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
at
org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
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(ApplicationDispatcher.java:683)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
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.java: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

Re: JSP Include error HELP!

2002-09-17 Thread Erick Todd

Great!!  That was it.  There should probably be some documentation about
that!?!?

I could not thank you enough!!

Erick

On Tue, 2002-09-17 at 11:11, Tim Funk wrote:
 I'm not sure about the compile warning.
 
 I think it has to do with mime types needing to be decalred in web.xml.
 
 For example: I have the following pages:
 foo.jsp with the contents
 
 hello jsp:include flush='false'  page=foo1.timisastoopidhead/
 
 And the file foo1.timisastoopidhead exists. And voila - I get the wacky 
 exception.
 
 BUT if add the following to web.xml:
mime-mapping
  extensiontimisastoopidhead/extension
  mime-typetext/plain/mime-type
/mime-mapping
 
 And restart tomcat (not reload, restart) - all is ok.
 
 
 So the moral of the story seems - register you file extension/mime type 
 in web.xml if you want to include it as a file.
 
 
 
 
 Erick Todd wrote:
  The second one works, however it does write a warning to the logs that
  the JSPNote javac.main has been depracated.  Do you know why that is? 
  So I would say that something is wrong with jsp:include.  However I
  really don't want to rewrite every jsp:include across all of my jsp
  pages!!
  
  Any idea why the straight include won't work?  Hey I really appreciate
  all the help here!!
  
  Or should I consider getting the source, rewriting jsp:include and
  re-compile?!?
  
  Erick
  
  On Tue, 2002-09-17 at 10:51, Tim Funk wrote:
  
 I can reproduce this - strange. Can you try either of the following:
 
 
 %String  largeAd=/includes/468x60ad.txt;%
 jsp:include page=%=largeAd% flush=true/
 
 OR
 
  InputStream ps = 
 application.getResourceAsStream(/includes/468x60ad.inc);
  if (ps!=null) {
  byte[] buffer = new byte[1024];
  int read = ps.read(buffer);
  while (read0) {
  out.print(new String(buffer, 0, read));
  read = ps.read(buffer);
  }
  ps.close();
  }
 
 
 
 Erick Todd wrote:
 
 Ok here is more info.  These pages all work on tomcat 3 right now.  I
 have stripped down the page to the bare problem and still get the error.
 
 I downgraded to Tomcat 4.0.4 because 4.1.10 has a problem doing regular
 static include across a symbolic link.  But for this problem of dynamic
 including, I have to use jsp:include because the String largeAd actually
 comes from a parent page.  But even in this simple situation, nothing
 works.   What am I doing wrong, configuration, JVM??
 
 I use the jdk1.4.1.  If I change the jsp:include to a %@ include . ..
 Everything works fine, but I have to be able to pass the string into the
 include, so I have to use jsp:include.
 Again, this works in all the older tomcats.  I just now upgrade from 3.2
 to 4.0.4.
 
 Lastly, I am on redhat linux 7.0 and 7.3
 
 Here is the jsp page.  Down to only 2 lines.
 %String  largeAd=/includes/468x60ad.inc;%
 jsp:include page=%=largeAd% flush=true/
 
 The contents of /includes.468x60ad.inc are just 5 lines of
 html/javascript.
 
 That's it.  I use mod_jk, (jk1) do a JkMount for the virtual host for
 *.jsp.  The server xml for this domain is:
Host name=cscom2.coloradosprings.com
 Context path= docBase=/www/sites/cscom/cscom debug=0
 reloadable=true 
 /Context
/Host
 
 And finally the stack trace from the log is:
 
 2002-09-17 10:20:59 StandardWrapperValve[jsp]: Servlet.service() for
 servlet jsp threw exception
 java.lang.IllegalStateException
 at
 
org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:109)
 at
 
org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1146)
 at
 org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
 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(ApplicationDispatcher.java:683)
 at
 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
 at
 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
 at
 org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:819)
 at org.apache.jsp.index$jsp._jspService(index$jsp.java:63)
 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.java:201)
 at