From: graemer <gra...@ya...> - 2007-08-31 12:01:12
|
Hi, I'm project lead of Grails and we embedd Jetty 6 as our embedded container that we ship with Grails. We have a problem at the moment where Jetty is unable to compile JSP pages. The reason this came about is that we stopped providing the JAR files inside the WARs /WEB-INF/lib directory, but instead we use a special class loader that we provide to Jetty 6 Our Groovy code to bootstrap Jetty looks like this: def server = new Server() grailsServer = server def connectors = [new SelectChannelConnector()] connectors[0].setPort(serverPort) server.setConnectors( (Connector [])connectors ) webContext = new WebAppContext("${basedir}/web-app", "/${grailsAppName}") webContext.setDefaultsDescriptor("${grailsHome}/conf/webdefault.xml") webContext.setClassLoader(classLoader) /// HERE IS THE CUSTOM CLASS LOADER SET webContext.setDescriptor(webXmlFile.absolutePath) grailsHandler = webContext server.setHandler( webContext ) The class loader itself is a URLClassLoader that has a reference to the jasper compiler, runtime and servlet API jars. Now the rest of Grails works fine and Grails' main view technology GSP continues to work fine. However there are a small percentage of users who still like to use JSP for whatever reason and for them they end up with errors like: HTTP ERROR: 500 Unable to compile class for JSP Generated servlet error: /tmp/Jetty_0_0_0_0_8080_web-app__test__ccyp2v/jsp/org/apache/jsp/index_jsp.java:3: package javax.servlet does not exist import javax.servlet.*; ^ Generated servlet error: /tmp/Jetty_0_0_0_0_8080_web-app__test__ccyp2v/jsp/org/apache/jsp/index_jsp.java:4: package javax.servlet.http does not exist import javax.servlet.http.*; ^ Generated servlet error: /tmp/Jetty_0_0_0_0_8080_web-app__test__ccyp2v/jsp/org/apache/jsp/index_jsp.java:5: package javax.servlet.jsp does not exist import javax.servlet.jsp.*; ^ Generated servlet error: /tmp/Jetty_0_0_0_0_8080_web-app__test__ccyp2v/jsp/org/apache/jsp/index_jsp.java:7: package org.apache.jasper.runtime does not exist public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase ^ Generated servlet error: /tmp/Jetty_0_0_0_0_8080_web-app__test__ccyp2v/jsp/org/apache/jsp/index_jsp.java:8: package org.apache.jasper.runtime does not exist implements org.apache.jasper.runtime.JspSourceDependent { ^ Now I'm not sure why this is happening as we are providing the correct class loader to Jetty. Could it be that Jetty is not passing said class loader over to Jasper compiler to compile the JSPs into bytecode? We're really stumped on this one so any help would be great Cheers Graeme Rocher Grails Project Lead http://grails.org -- View this message in context: http://www.nabble.com/JSP-Compilation-Errors-with-custom-class-loader-tf4359757.html#a12425168 Sent from the Jetty Support mailing list archive at Nabble.com. |