如何解决java.lang.IllegalStateException:没有Java编译器可用于配置选项compilerClassName

时间:2017-08-29 11:18:14

标签: tomcat8

如何解决java.lang.IllegalStateException:没有可用于配置选项compilerClassName的Java编译器。 我使用embedded-tomcat 8.0.46和春天4.3.10.RELEASE

java.lang.IllegalStateException: No Java compiler available for configuration options compilerClassName: [null] and comp
iler: [null]
        at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:231)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:578)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:716)

2 个答案:

答案 0 :(得分:2)

尝试添加

<dependency>
    <groupId>org.eclipse.jdt.core.compiler</groupId>
    <artifactId>ecj</artifactId>
    <version>4.6.1</version>
    <scope>provided</scope>
</dependency>

到maven pom.xml。

看看: https://www.mkyong.com/spring-boot/spring-boot-web-jsp-no-java-compiler-available/

答案 1 :(得分:0)

添加以下依赖项并保存。您可能需要重新启动应用程序。

<dependency>
    <groupId>org.eclipse.jdt.core.compiler</groupId>
    <artifactId>ecj</artifactId>
    <version>4.6.1</version>
    <scope>provided</scope>
</dependency>