You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Linda Smith <li...@yahoo.com> on 2004/04/04 22:07:32 UTC

Unable to compile class for JSP

I have included at the end of the message the
exception I get when following the "JSP page" link
from the Hello World example provided in the tomcat
documentation.
I get a very similar exception when trying to open one
of my own jsp-s, although the project builds
successfully.(using "ant" and "ant install")
Other jsp examples provided with tomcat seem to work
fine.
i'm using fedora core 1 (linux) and j2sdk1.4.2_02
I have copied tools.jar to 
$catalina_home/common/lib
I have also restarted tomcat, i've tried different
browsers, none of these solved the problem.

What have I left out?

Thanks for your time

exception

org.apache.jasper.JasperException: Unable to compile
class for JSP
       
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:559)
       
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
       
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
       
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
       
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.io.FileNotFoundException:
/home/ralu/jakarta-tomcat-5.0.19/work/Catalina/localhost/tomcat-docs/org/apache/jsp/appdev/sample/web/hello_jsp.java
(No such file or directory)
        java.io.FileOutputStream.open(Native Method)
       
java.io.FileOutputStream.<init>(FileOutputStream.java:179)
       
java.io.FileOutputStream.<init>(FileOutputStream.java:70)
       
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223)
       
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
       
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
       
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
       
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
       
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
       
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
       
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)



__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Unable to compile class for JSP

Posted by Schalk <sc...@volume4.co.za>.
You need import the bean and classes you intend to use in the JSP, this
might solve the problem.

Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Development.Multimedia.Branding
emotionalize.conceptualize.visualize.realize
Tel: +27125468436
Fax: +27125468436
email:schalk@volume4.co.za
web: www.volume4.com
 
This message contains information that is considered to be sensitive or
confidential and may not be forwarded or disclosed to any other party
without the permission of the sender. If you received this message in error,
please notify me immediately so that I can correct and delete the original
email. Thank you. 

:: -----Original Message-----
:: From: Linda Smith [mailto:lindalinda20042003@yahoo.com]
:: Sent: Sunday, April 04, 2004 11:06 PM
:: To: Tomcat Users List
:: Subject: RE: Unable to compile class for JSP
:: 
:: note: using Tomcat 5.0.19
:: 
:: my files: Test.jsp
:: <html><body>
:: <h2>Welcome</H2>
:: <BR>
:: <h1>
:: <FORM TYPE=POST ACTION=web_search.SServlet>
:: <INPUT type=submit name=operation value="search">
:: </FORM>
:: </H1>
:: </body></html>
:: 
:: and Search.jsp
:: <html><head>
:: <title>Search page</TITLE>
:: <body>
:: <h2>Welcome</H2>
:: <BR>
:: <h1>
:: <FORM TYPE=POST ACTION=web_server.SServlet>
:: <INPUT size="30" name=searchString>
:: <INPUT type=submit name=operation value="Search">
:: </FORM>
:: <jsp:useBean id='agent' type='web_search.Results'
:: scope='request'>
:: <jsp:setProperty name='agent' property='sa' value='<%=
:: request.getParameter("search_agent")%>' />
:: <jsp:setProperty name='agent' property='searchString'
:: param='searchString' />
:: </jsp:useBean>
:: <jsp:setProperty name='agent' property='noResults'
:: value='<%= request.getParameter("no_results")%>' />
:: <jsp:setProperty name='agent' property='searchResult'
:: value='<%= request.getParameter("search_result")%>' />
:: <jsp:getProperty name='agent' property='searchResult'
:: />
:: </H1>
:: </body></html>
:: 
:: 
:: the hello.jsp in
:: $catalina_home/webapps/tomcat-docs/appdev/sample/web
:: <html>
:: <head>
:: <title>Sample Application JSP Page</title>
:: </head>
:: <body bgcolor=white>
:: 
:: <table border="0">
:: <tr>
:: <td align=center>
:: <img src="images/tomcat.gif">
:: </td>
:: <td>
:: <h1>Sample Application JSP Page</h1>
:: This is the output of a JSP page that is part of the
:: Hello, World
:: application.  It displays several useful values from
:: the request
:: we are currently processing.
:: </td>
:: </tr>
:: </table>
:: 
:: <table border="0" border="100%">
:: <tr>
::   <th align="right">Context Path:</th>
::   <td align="left"><%= request.getContextPath()
:: %></td>
:: </tr>
:: <tr>
::   <th align="right">Path Information:</th>
::   <td align="left"><%= request.getPathInfo() %></td>
:: </tr>
:: <tr>
::   <th align="right">Query String:</th>
::   <td align="left"><%= request.getQueryString()
:: %></td>
:: </tr>
:: <tr>
::   <th align="right">Request Method:</th>
::   <td align="left"><%= request.getMethod() %></td>
:: </tr>
:: <tr>
::   <th align="right">Servlet Path:</th>
::   <td align="left"><%= request.getServletPath()
:: %></td>
:: </tr>
:: </table>
:: </body>
:: </html>
:: 
:: 
:: __________________________________
:: Do you Yahoo!?
:: Yahoo! Small Business $15K Web Design Giveaway
:: http://promotions.yahoo.com/design_giveaway/
:: 
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
:: For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Unable to compile class for JSP

Posted by Linda Smith <li...@yahoo.com>.
note: using Tomcat 5.0.19

my files: Test.jsp
<html><body>
<h2>Welcome</H2>
<BR>
<h1>
<FORM TYPE=POST ACTION=web_search.SServlet>
<INPUT type=submit name=operation value="search">
</FORM>
</H1>
</body></html>

and Search.jsp
<html><head>
<title>Search page</TITLE>
<body>
<h2>Welcome</H2>
<BR>
<h1>
<FORM TYPE=POST ACTION=web_server.SServlet>
<INPUT size="30" name=searchString>
<INPUT type=submit name=operation value="Search">
</FORM>
<jsp:useBean id='agent' type='web_search.Results'
scope='request'>
<jsp:setProperty name='agent' property='sa' value='<%=
request.getParameter("search_agent")%>' />
<jsp:setProperty name='agent' property='searchString'
param='searchString' />
</jsp:useBean>
<jsp:setProperty name='agent' property='noResults'
value='<%= request.getParameter("no_results")%>' />
<jsp:setProperty name='agent' property='searchResult'
value='<%= request.getParameter("search_result")%>' />
<jsp:getProperty name='agent' property='searchResult'
/>
</H1>
</body></html>


the hello.jsp in
$catalina_home/webapps/tomcat-docs/appdev/sample/web
<html>
<head>
<title>Sample Application JSP Page</title>
</head>
<body bgcolor=white>

<table border="0">
<tr>
<td align=center>
<img src="images/tomcat.gif">
</td>
<td>
<h1>Sample Application JSP Page</h1>
This is the output of a JSP page that is part of the
Hello, World
application.  It displays several useful values from
the request
we are currently processing.
</td>
</tr>
</table>

<table border="0" border="100%">
<tr>
  <th align="right">Context Path:</th>
  <td align="left"><%= request.getContextPath()
%></td>
</tr>
<tr>
  <th align="right">Path Information:</th>
  <td align="left"><%= request.getPathInfo() %></td>
</tr>
<tr>
  <th align="right">Query String:</th>
  <td align="left"><%= request.getQueryString()
%></td>
</tr>
<tr>
  <th align="right">Request Method:</th>
  <td align="left"><%= request.getMethod() %></td>
</tr>
<tr>
  <th align="right">Servlet Path:</th>
  <td align="left"><%= request.getServletPath()
%></td>
</tr>
</table>
</body>
</html>


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Unable to compile class for JSP

Posted by Schalk <sc...@volume4.co.za>.
Maybe you can provide a copy of the JSP?

Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Development.Multimedia.Branding
emotionalize.conceptualize.visualize.realize
Tel: +27125468436
Fax: +27125468436
email:schalk@volume4.co.za
web: www.volume4.com
 
This message contains information that is considered to be sensitive or
confidential and may not be forwarded or disclosed to any other party
without the permission of the sender. If you received this message in error,
please notify me immediately so that I can correct and delete the original
email. Thank you. 

:: -----Original Message-----
:: From: Linda Smith [mailto:lindalinda20042003@yahoo.com]
:: Sent: Sunday, April 04, 2004 10:08 PM
:: To: tomcat-user@jakarta.apache.org
:: Subject: Unable to compile class for JSP
:: 
:: 
:: I have included at the end of the message the
:: exception I get when following the "JSP page" link
:: from the Hello World example provided in the tomcat
:: documentation.
:: I get a very similar exception when trying to open one
:: of my own jsp-s, although the project builds
:: successfully.(using "ant" and "ant install")
:: Other jsp examples provided with tomcat seem to work
:: fine.
:: i'm using fedora core 1 (linux) and j2sdk1.4.2_02
:: I have copied tools.jar to
:: $catalina_home/common/lib
:: I have also restarted tomcat, i've tried different
:: browsers, none of these solved the problem.
:: 
:: What have I left out?
:: 
:: Thanks for your time
:: 
:: exception
:: 
:: org.apache.jasper.JasperException: Unable to compile
:: class for JSP
:: 
::
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
59)
:: 
::
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
91)
:: 
:: org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
:: 
:: org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
:: 
:: javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
:: 
:: 
:: root cause
:: 
:: java.io.FileNotFoundException:
:: /home/ralu/jakarta-tomcat-5.0.19/work/Catalina/localhost/tomcat-
:: docs/org/apache/jsp/appdev/sample/web/hello_jsp.java
:: (No such file or directory)
::         java.io.FileOutputStream.open(Native Method)
:: 
:: java.io.FileOutputStream.<init>(FileOutputStream.java:179)
:: 
:: java.io.FileOutputStream.<init>(FileOutputStream.java:70)
:: 
:: org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:223)
:: 
:: org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
:: 
:: org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
:: 
::
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
53)
:: 
::
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
91)
:: 
:: org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
:: 
:: org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
:: 
:: javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
:: 
:: 
:: 
:: __________________________________
:: Do you Yahoo!?
:: Yahoo! Small Business $15K Web Design Giveaway
:: http://promotions.yahoo.com/design_giveaway/
:: 
:: ---------------------------------------------------------------------
:: To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
:: For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org