“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条回答
劳资没心,怎么记你
2楼-- · 2019-01-07 08:05

if you set environment variable JRE_HOME , please unset or delete it and start server again .

查看更多
迷人小祖宗
3楼-- · 2019-01-07 08:05

In liferay 7 : I got this error fixed by changing the runtime environment of the server from jre to jre with jdk

查看更多
时光不老,我们不散
4楼-- · 2019-01-07 08:07

You have planty solutions guys but I thought that it exist a solution better than fix the start.ini

I lived the same problem and then I realize that it may be because I did have a JDK7 for 64bit while I should have a JDK7 for 32.

So I fixed my problem by downloading and use the JDK7 for 32Bit.

Also, you would still need to

  • Use the JDK and not the JRE
  • Set your JAVA_HOME

I am running on Windows by the way ...

查看更多
何必那么认真
5楼-- · 2019-01-07 08:13

Ok, solved this after a lot of searching around.

Download any jdk and point JAVA_HOME to this jdk. Inside this jdk folder you will find ./bin and ./jre/bin Copy the javac from ./bin and paste it in ./jre/bin [remember copy not cut]

Now in eclipse, Run->External-Tools->External-Tools-Configurations, select the build.xml for of your project in the left pane and click on the JRE tab in the right pane. Click on installed JREs and add the jdk in the previous step. Once done, select this new JRE (jdk1.6.0_31) as the 'Separate JRE', click on apply at the bottom and run.

This assumes you are doing a jetty:run using ant on eclipse.

查看更多
干净又极端
6楼-- · 2019-01-07 08:14

I got the PWC6345 error when running a webapp with Run-Jetty-Run plugin.

The fix was to change the Execution environments settings in Preferences. Since I'm using java 7 I needed to change the setting for JavaSE-1.7. Probably other execution environments will behave similarly.

Window -> Preferences -> Java -> Installed JREs -> Execution environments

Select JavaSE-1.7 on the left -> pick the *jdk*1.7.x_xx on the right hand side

查看更多
我命由我不由天
7楼-- · 2019-01-07 08:15

In addition to updating the JAVA_HOME (see above)... If you're encountering this error from command line (e.g. starting Jetty server from dos window), check where windows is finding the java.exe:

where java

If windows comes back with a path showing to your jre, then check your PATH. Chances are the %PATH% contains a path pointing to the jre instead of jdk.

查看更多
登录 后发表回答