Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] getting the right classpath to jasper from embedded jetty

Hi all,

I have written a test case that runs an embedded instance of jetty, that uses a WebAppContext to boot a web app at http://localhost:8080.  Then my test case uses WebDriver to go to this url.  Whats behind this URL is index.jsp.

I use the <junit> task in ant to run this test case, without forking the vm.  The classpath I specify in the <junit> task is sufficient for index.jsp to be compiled.  It also contains all the necessary jasper files.

But when jasper runs in this context, it seems to run with little more than the ant system classpath, and my jsp fails to compile.  Summarised, like this:

Feb 19, 2010 5:19:08 PM org.apache.jasper.compiler.AntCompiler generateClass
SEVERE: Error compiling file: /private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp/org/apache/jsp/index_jsp.java     [javac] Compiling 1 source file

/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp/org/apache/jsp/index_jsp.java:3: package javax.servlet does not exist
import javax.servlet.*;

.......

Feb 19, 2010 5:19:08 PM org.apache.jasper.compiler.AntCompiler generateClass
SEVERE: Environment: Compile: javaFileName=/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp/org/apache/jsp/index_jsp.java
   classpath=/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp:null
   cp=/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-jai.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-nodeps.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-testutil.jar:/usr/share/ant/lib/ant-trax.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/xercesImpl.jar:/usr/share/ant/lib/xml-apis.jar
   cp=/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp
   cp=null
   work dir=/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp
   extension dir=/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/ext
   srcDir=/private/var/folders/Ma/MazvaPcbFyWuDMFq6hU5Ok+++TI/-Tmp-/Jetty_0_0_0_0_8080_web____uv1e71/jsp
  compilerTargetVM=1.5
  compilerSourceVM=1.5
   include=org/apache/jsp/index_jsp.java

I poked about a little in the jasper code and found that tomcat somehow communicates the classpath for a jsp using the init param "org.apache.catalina.jsp_classpath".  Which will not be present in my setup, so I guess thats why I see "null" up there in the dumped out classpath.

I'll shut up now and get down to the question:  is there any way I can make this scenario work?  As a work around, I am having <junit> fork, so the system classpath is the classpath I want, but  I do not like doing that, and just for interest at this stage, I want to see what it be pulled off.

Thanks all,
Mike.

Back to the top