Take a look at the jasper-howto.html in the tomcat-docs webapp (the "JSPs" link in the tomcat-docs home page). It describes how to "turn off" the Eclipse JDT compiler, which is old enough in Tomcat 5.5.9 that it doesn't include Java 5.0 support. You could also try a newer version of Tomcat 5.5.x and get a version of the Eclipse JDT compiler that does support Java 5.0.
Cheers, Larry > -----Original Message----- > From: Daniel Gresh [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 15, 2007 2:52 PM > To: Tomcat Users List > Subject: Re: Tomcat 5.5.9 on Sun Solaris: JSP compilation error > > APliszka-Public wrote: > > 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(DefaultErro > >> rHandler.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] > > > > > Hi, thanks for the reply. > > I changed my code to use a JDK1.4 feature, assert, like this: > > <% > boolean s = true; > assert s; > %> > > and it compiled fine. > > So apparently it is not compiling for JDK1.5. How would I > tell it to do so? I looked at $CATALINA_HOME/conf/server.xml, > but I wasn't sure if that was where I was supposed to make > the configuration change. How would I do so? > > Thanks, > 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]