Try using code that is not 1.5 specific [like for(String x: s)] if it is
going to work then your pages are compiled as Java 1.4 source code, you
will have change tomcat config to so jsp compiler is compailing Java 1.5
source.
Andrew Pliszka
Daniel Gresh wrote:
Hi list,
Recently I upgraded Tomcat from 4.0.5 to 5.5.9, due to some unusual
problems I was experiencing with Tomcat 4.0.5. I was getting some Java
compilation errors when I used JDK1.5 features, and neither I nor the
two who replied to my message could figure out why. Upgrading was
suggested, so we upgraded to Tomcat 5.5.9.
I'm running some simple tests using some basic code that involves
JDK1.5 to find out if everything can compile correctly. However, when
I deploy my index.jsp to the server and try to launch it from
http://localhost:port#, I get a compilation error that makes no sense
to me (because I know the code I have compiles correctly with javac).
This is the index.jsp file:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>TEXT</title></head>
<body>
<%
String[] s = {"1", "2"};
for (String x : s) {
}
%>
</body>
</html>
This is the error message:
HTTP Status 500 -
------------------------------------------------------------------------
*type* Exception report
*message*
*description* _The server encountered an internal error () that
prevented it from fulfilling this request._
*exception*
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token(s), misplaced construct(s)
An error occurred at line: 9 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token ")", : expected
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
I don't know what is wrong. I have JDK1.5.0_06 installed on the UNIX
box Tomcat is installed on, so the code should certainly be compiling.
One thing that bothers me is this:
When I use shutdown.sh or startup.sh to shutdown and startup Tomcat,
respectively, the terminal output tells me:
"Using JRE_HOME: /usr/local/jdk1.5.0_06"
Should this not be JAVA_HOME instead of JRE_HOME? I have a JAVA_HOME
environment variable that is set to what JRE_HOME is currently set to.
Also when I use "printenv JRE_HOME", it returns nothing. Is this a
problem?
Thanks for any help you can offer,
Dan
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]