Hello, I have just spent 4+ hours trying to get Tomcat 6(.0.14) to compile my JSPs with Java 1.6. I have googled, found some things and tried, but have had no luck getting it to work.
I found a page with instructions on getting Tomcat 5.5 running with Java 1.5 (a page linked to from several posts in the archives of this list): http://blog.taragana.com/index.php/archive/how-to-run-javac-15-or-beyond-compiler-for-jsp-compilation-in-tomcat-55-with-generics-enabled-and-other-15-only-features/ I adapted the instructions for Tomcat 6. Here's what I did: * Copy tools.java from $JAVA_HOME/lib to $CATALINA_HOME/lib * Renamed jasper-compiler-jdt.jar to jasper-compiler-jdt.jar.old * Installed the latest binary version of ANT * Copied ant.jar from the Ant distribution to $CATALINA_HOME/lib * Edited $CATALINA_HOME/conf/web.xml, so that the JSP servlet has the compilerSourceVM and compilerTargetVM init parameters set: <servlet> <servlet-name>jsp</servlet-name> <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> <init-param> <param-name>fork</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>compilerSourceVM</param-name> <param-value>1.5</param-value> </init-param> <init-param> <param-name>compilerTargetVM</param-name> <param-value>1.5</param-value> </init-param> <init-param> <param-name>xpoweredBy</param-name> <param-value>false</param-value> </init-param> <load-on-startup>3</load-on-startup> </servlet> Furthermore, the Tomcat 6 Jasper How-To at http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html , in the last paragraph of the "Configuration" section states that to use Ant instead of the standard Eclipse JDT compiler, I need use the javac argument to catalina.sh. I have done this. However, whenever I try to get tomcat to compile a JSP, I get errors -- it actually alternates (irregularly) between two errors. The relevant parts of the error messages (I'm including the full errors at the bottom of this message, but for readability abbreviating them here): Error 1: root cause java.lang.NullPointerException org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:167) org.apache.jasper.compiler.Compiler.compile(Compiler.java:308) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:273) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) Error 2: root cause org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) In case it makes a big difference, I'm running: * CentOS 4 (RHEL equivalent; 64-bit x86) * jdk 1.6.0_02 * Tomcat 6.0.14 (as previously mentioned) I doubt that it makes a difference, but I'm running Tomcat as a service. The following environment variables are set before Tomcat is started: export JAVA_HOME=/usr/java/jdk1.6/ export CATALINA_HOME=/usr/local/tomcat export CATALINA_OPTS="-javac" export JRE_HOME=/usr/java/jdk1.6/ export ANT_HOME=/usr/local/ant export PATH=${ANT_HOME}/bin:${PATH}: As far as I can tell, I have followed all of the instructions correctly. Can anybody suggest anything that - I've done wrong, based on these instructions; - is wrong with these instructions; and/or - has nothing to do with these instructions, but might give me what I want? In terms of Java 1.5 vs 1.6, I don't care which I get. I just want to be able to use generics in my JSPs, since I'm using them in my servlets, and want the JSPs to be able to handle them neatly. Thanks very much if you bothered to read this far, and thanks in advance for any help! Hopefully someone will know what I need to do :-) Cheers, Johannes. ********************************************************************** Full Error 1: 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: org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) root cause org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) root cause java.lang.ClassNotFoundException: org.apache.jsp.common.display.Photos.list_jsp java.net.URLClassLoader$1.run(URLClassLoader.java:200) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(URLClassLoader.java:188) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66) org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs. Apache Tomcat/6.0.14 Full Error 2: 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: org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) root cause org.apache.jasper.JasperException: Unable to load class for JSP org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) root cause java.lang.ClassNotFoundException: org.apache.jsp.common.display.Photos.list_jsp java.net.URLClassLoader$1.run(URLClassLoader.java:200) java.security.AccessController.doPrivileged(Native Method) java.net.URLClassLoader.findClass(URLClassLoader.java:188) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66) org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.Servlet.displayJSPDirect(Servlet.java:118) au.com.netek.clubs.servlet.Servlet.displayJSP(Servlet.java:128) au.com.netek.clubs.servlet.admin.ImageManagementServlet.photoList(ImageManagementServlet.java:656) au.com.netek.clubs.servlet.admin.ImageManagementServlet.doGetReal(ImageManagementServlet.java:176) au.com.netek.clubs.servlet.DataStoreAccessServlet.doGetWrapped(DataStoreAccessServlet.java:93) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) au.com.netek.clubs.servlet.admin.EnsureLoginServlet.doGetWrapped(EnsureLoginServlet.java:139) au.com.netek.clubs.servlet.Servlet.doGet(Servlet.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:694) org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:665) org.apache.jsp.staffexec.photos.list_jsp._jspService(list_jsp.java:78) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176) org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:728) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs. Apache Tomcat/6.0.14 --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]