I've been using maven2 with the org.codehaus.mojo.jspc maven plugin for
quite some time. Just the other day, jsp builds suddenly stopped working
with the "No java compiler available" message.
My pom looks like:
<plugin>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
<includeInProject>true</includeInProject>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<!-- Use the Tomcat 5 JSP compiler -->
<dependencies>
<dependency>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-compiler-tomcat5</artifactId>
<version>2.0-alpha-1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${pom.basedir}/target/jspweb.xml</webXml>
</configuration>
</plugin>
This has been unchanged for a long time. I use tomcat5 which means it is
using tomcat 5.5.15 jars. I confirmed that the
jasper-compiler-5.5.15.jar and jasper-compiler-jdt-5.5.15.jar are on the
classpath by doing a maven -X install. So in theory, the
org.apache.jasper.JspCompilationContext createCompiler() method (yes i
started digging in the tomcat source code):
if (options.getCompiler() == null) {
jspCompiler =
createCompiler("org.apache.jasper.compiler.JDTCompiler");
if (jspCompiler == null) {
jspCompiler =
createCompiler("org.apache.jasper.compiler.AntCompiler");
}
} else {
jspCompiler =
createCompiler("org.apache.jasper.compiler.AntCompiler");
if (jspCompiler == null) {
jspCompiler =
createCompiler("org.apache.jasper.compiler.JDTCompiler");
}
}
if (jspCompiler == null) {
throw new
IllegalStateException(Localizer.getMessage("jsp.error.compiler"));
}
should resolve the JDTCompiler and AntCompiler since the jars are on the
classpath. The IllegalStateException is the exception being thrown:
java.lang.IllegalStateException: No Java compiler available
at
org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationCon
text.java:224)
at org.apache.jasper.JspC.processFile(JspC.java:979)
I saw that 2.0-alpha-2 version came out this month so I tried that with
no luck.
I am using Artifactory as my maven repo. For the common jars, it just
grabs from the maven2 repo. I deleted everything out of my artifactory
repo cache to force it to re-retrieve what the build needs. I also
deleted my local maven repo directory. All resulted in failure. I also
bounced artifactory which didn't work.
I triple checked that the jasper compiler jars (both of them) are on my
machine and they are listed in the classpath for the build. Usually this
type of error means something is missing from the classpath. If the
jasper compiler jars are on the classpath, what else would be missing
all of a sudden. It's been working for almost a year just fine. I'm
guessing that maybe JDTCompiler can't be loaded because a dependency it
has on something can't be found.
I based my implementation on:
http://mojo.codehaus.org/jspc/jspc-maven-plugin/usage.html, changing
tomcat 6 to tomcat 5 and adding version because maven complained about
requiring a version element.
I searched the web the last 2 days and didn't find anyone else having
this problem. Which tells me a configuration/dependency issue on my end.
But nothing has changed here.
And it isn't just my own development machine. The buildmachine (using
Teamcity) is also failing with the same exact error.
Any ideas where to start looking? Are others seeing this behavior where
jspc is suddenly failing?
Randy Eckhoff
Principal Engineer, Architect
GoFish Corporation
[EMAIL PROTECTED]
http://www.gofishcorp.com <http://www.gofishcorp.com/>