You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jesse Farinacci <ji...@gmail.com> on 2011/06/23 21:41:26 UTC

Dreaded No Java compiler available

Greetings,

I am launching an embedded Apache Tomcat 7.0.14, everything except
JSPs are working fine (static resources, servlets, filters, etc). I
have set JAVA_HOME to a location which does have bin/javac and
lib/tools.jar, and otherwise does appear to be a fully working JDK.
However, I take the following exception:

SEVERE: Exception Processing ErrorPage[errorCode=404,
location=/error-pages/404.jsp]
Throwable occurred: org.apache.jasper.JasperException:
java.lang.IllegalStateException: No Java compiler available
 at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:570)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:378)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:473)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
 at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:466)
 at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:387)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:181)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
 at java.lang.Thread.run(Thread.java:736)
Caused by: java.lang.IllegalStateException: No Java compiler available
 at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:231)
 at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
 ... 21 more

My project has the following Apache Tomcat dependencies (all 7.0.14):

    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>tomcat-util</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-logging-juli</artifactId>
    </dependency>

I am not finding any corresponding jasper-compiler or
jasper-compiler-jdt with the 7.x version scheme. Sorry, but what am I
doing wrong?

Thanks,
-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Dreaded No Java compiler available

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jesse Farinacci [mailto:jieryn@gmail.com] 
> Subject: Dreaded No Java compiler available

> I am launching an embedded Apache Tomcat 7.0.14

JDK version?  Platform?  (Probably not relevant in this case, but it helps to know the full environment.)

> I have set JAVA_HOME to a location which does have bin/javac and
> lib/tools.jar, and otherwise does appear to be a fully working JDK.

The default Tomcat JSP mechanism hasn't used the Java compiler from the JDK for several years now.

> Throwable occurred: org.apache.jasper.JasperException:
> java.lang.IllegalStateException: No Java compiler available

Tomcat 7 JSP handling normally uses the Eclipse JDT compiler from lib/ecj-3.6.2.jar; is that jar accessible to the Tomcat classloader in your embedded environment?

Are you trying to run this from an IDE?  What happens if you execute the application directly?  (IDEs often obfuscate the situation by choosing to use their own configuration settings.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Dreaded No Java compiler available

Posted by Jesse Farinacci <ji...@gmail.com>.
Greetings,

On Thu, Jun 23, 2011 at 4:37 PM, Konstantin Kolinko
<kn...@gmail.com> wrote:
>
> Latest Tomcat 6 and Tomcat 7 do use the ecj compiler from Eclipse IDE
> project directly, without repacking it.
>
> If you are struggling with maven, some discussion of troubles with
> downloading ecj is here:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=50604#c1

Thank you, Konstantin! Adding the following solved my issue:

    <dependency>
      <groupId>org.eclipse.jdt.core.compiler</groupId>
      <artifactId>ecj</artifactId>
      <version>3.5.1</version>
      <scope>runtime</scope>
    </dependency>

I am now able to compile my JSPs on the fly, automatically, in Apache
Tomcat. Despite Mark's comments about bulky downloads in the link you
gave earlier, I find it adds only ~1.5Mb to the already dense ~25Mb
executable jar which I'm building.

Thank you,
-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Dreaded No Java compiler available

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/6/23 Jesse Farinacci <ji...@gmail.com>:
> Greetings,
>
> I am launching an embedded Apache Tomcat 7.0.14, everything except
> JSPs are working fine (static resources, servlets, filters, etc). I
> have set JAVA_HOME to a location which does have bin/javac and
> lib/tools.jar, and otherwise does appear to be a fully working JDK.
> However, I take the following exception:
>
>(...)
>
> My project has the following Apache Tomcat dependencies (all 7.0.14):
>
>    <dependency>
>      <groupId>org.apache.tomcat</groupId>
>      <artifactId>tomcat-util</artifactId>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.tomcat.embed</groupId>
>      <artifactId>tomcat-embed-core</artifactId>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.tomcat.embed</groupId>
>      <artifactId>tomcat-embed-jasper</artifactId>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.tomcat.embed</groupId>
>      <artifactId>tomcat-embed-logging-juli</artifactId>
>    </dependency>
>
> I am not finding any corresponding jasper-compiler or
> jasper-compiler-jdt with the 7.x version scheme. Sorry, but what am I
> doing wrong?

They do not exist. (Have you looked into zip distribution?)

Latest Tomcat 6 and Tomcat 7 do use the ecj compiler from Eclipse IDE
project directly, without repacking it.

If you are struggling with maven, some discussion of troubles with
downloading ecj is here:
https://issues.apache.org/bugzilla/show_bug.cgi?id=50604#c1

I think you can search for "ecj" in this mailing list archives and
find several discussions there.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org