“PWC6345: There is an error in invoking javac.” er

2019-01-07 07:35发布

I'm trying to deploy a JSP-page on Jetty, using the Jetty WTP plugin for Eclipse. But I get the error below. It looks like Jetty can't find javac. Is there any settings I have to do for the Jetty WTP plugin in Eclipse or how do I fix this?

The JSP page works fine if I export my project as a .war-file to jetty\webapps and then start Jetty manually using java -jar start.jar. But it doesn't work if I deploy using the Jetty WTP plugin for Eclipse as described.

I have my JAVA_HOME set to C:\Program Files (x86)\Java\jdk1.7.0_01 and I use Jetty 8.0.4 on Windows 7.

Servlets is working fine with the current setup. Any suggestions on how to solve this for JSP pages?

HTTP ERROR 500
Problem accessing /MyJavaWeb/formProcess. Reason: 

    PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required

Caused by:
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required
    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:119)
    at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:208)
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:271)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98)
    at com.example.FormProcessServlet.doPost(FormProcessServlet.java:39)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
    at org.eclipse.jetty.server.Server.handle(Server.java:346)
    at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442)
    at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:941)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
    at java.lang.Thread.run(Unknown Source)

14条回答
We Are One
2楼-- · 2019-01-07 08:17

Strange because this thread suggests:

The solution was to install the package jdk7-openjdk.
Perhaps this should be added to the list of dependencies (or maybe for jetty, and not solr itself)?

But that doesn't help much on Windows, where the binary for openjdk7 aren't easily available.
(In "OpenJDK availability for Windows OS" comments, eckes mentions having found some openjdk binaries for Windows, as part of the Build b146. However, said releases aren't maintained any more)

The bug report filled by the OP Jonas is closed with a simple reference to the Eclipse wiki page "Jetty/Howto/Configure JSP".

查看更多
疯言疯语
3楼-- · 2019-01-07 08:18

I spent good amount of time on this issue, but it turned out to be very simple. All you have to do is:
choose the JDK instead of JRE while configuring the server runtime!

It worked like a champ, I had this issue with glassFish 4.0

查看更多
做自己的国王
4楼-- · 2019-01-07 08:20

I too happened to suddenly get the org.apache.jasper.JasperException: PWC6345 with my Eclipse installation and the Jetty Maven Plugin (which I use to start up Jetty from within Eclipse).

The reason was that I updated my JDK installation shortly before. Inside Eclipse, this caused to change the "Installed JRE" to point to a plain JRE installation instead of a full-fledged JDK installation. A JDK installation is needed for Jasper, as Jasper needs javac (which is not provided by JRE).

In my case, the solution was to provide Eclipse with the JDK installation. To do so, select Window -> Preferences -> Java -> Installed JREs. Here, click Add..., then point to your JDK installation (in my case, JRE home should point to C:\Program Files (x86)\Java\jdk1.7.0_17). Click Finish. Then back in the Installed JREs overview, remove the old JRE reference and select the newly added JDK installation.

查看更多
你好瞎i
5楼-- · 2019-01-07 08:21

As Jan Bartel suggested, from Jetty: How to configure JSP:

by adding the line below in the start.ini-file in Eclipse, it works fine.

-Dorg.apache.jasper.compiler.disablejsr199=true

enter image description here

查看更多
We Are One
6楼-- · 2019-01-07 08:23

I have the same problem. When I run where java, the output is:

C:\Windows\System32\java.exe

D:\Program Files\Java\jdk1.7.0_25\bin\java.exe

Of course the first one is incorrect. So my problem lies in the PATH. I can rectify this by either removing the java.exe in the directory C:\Windows\System32\ because I'm sure it's useless, or putting the second entry in front of the first one.

So When encountering this problem, please check your PATH for the jdk. I hope that my problem and my solution is helpful in some way.

查看更多
虎瘦雄心在
7楼-- · 2019-01-07 08:23

I got this error when deploy war package to our server.

My deploy command is (applied web container you may find):

java  -jar jetty-runner.jar  --port 8020 xx.war

I write this answer because it confused me almost one day. I tried some methods above but failed.

Finally I found there is only jre on my servers but not full jdk.

$ls /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7_3.x86_64
jre

I fix it with searching available jdk and install one.

$yum search java | grep 'java-'
$sudo yum install java-1.8.0-openjdk-devel.x86_64

(Notice the -devel)

查看更多
登录 后发表回答