windows “PWC6345:调用 javac 时出错。” 使用 Jetty WTP 插件在 Jetty 上部署 JSP 页面时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9113346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:11:01  来源:igfitidea点击:

"PWC6345: There is an error in invoking javac." error when using Jetty WTP plugin to deploy a JSP page on Jetty

windowsjspjettyeclipse-wtp

提问by Jonas

I'm trying to deploy a JSP-page on Jetty, using the Jetty WTP pluginfor 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?

我正在尝试使用Eclipse的Jetty WTP 插件Jetty上部署 JSP 页面。但我收到以下错误。看起来 Jetty 找不到javac. 我是否需要为 Eclipse 中的 Jetty WTP 插件做任何设置,或者如何解决这个问题?

The JSP page works fine if I export my project as a .war-file to jetty\webappsand 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.

如果我将项目作为.war-file导出到jetty\webapps,然后使用java -jar start.jar. 但是,如果我按照描述使用 Eclipse 的 Jetty WTP 插件进行部署,则它不起作用。

I have my JAVA_HOMEset to C:\Program Files (x86)\Java\jdk1.7.0_01and I use Jetty 8.0.4 on Windows 7.

我已经JAVA_HOME设置为C:\Program Files (x86)\Java\jdk1.7.0_01并且在 Windows 7 上使用 Jetty 8.0.4。

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

Servlets 在当前设置下工作正常。有关如何为 JSP 页面解决此问题的任何建议?

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.run(SelectChannelEndPoint.java:44)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.run(QueuedThreadPool.java:533)
    at java.lang.Thread.run(Unknown Source)

回答by Jonas

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

正如 Jan Bartel 所建议的,来自Jetty: How to configure JSP

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

通过start.ini在 Eclipse的-file 中添加以下行,它工作正常。

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

enter image description here

在此处输入图片说明

回答by Abdull

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

我也碰巧突然获得了org.apache.jasper.JasperException: PWC6345Eclipse 安装和Jetty Maven 插件(我用它从 Eclipse 中启动 Jetty)。

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).

原因是我不久前更新了我的 JDK 安装。在 Eclipse 中,这导致将“已安装的 JRE”更改为指向普通的 JRE 安装而不是完整的 JDK 安装。Jasper 需要安装 JDK,因为 Jasper 需要javac(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 homeshould point to C:\Program Files (x86)\Java\jdk1.7.0_17). Click Finish. Then back in the Installed JREsoverview, removethe old JRE referenceand select the newly added JDK installation.

就我而言,解决方案是为 Eclipse 提供 JDK 安装。为此,请选择Window -> Preferences -> Java -> Installed JREs。在这里,单击Add...,然后指向您的 JDK 安装(在我的例子中,JRE home应该指向C:\Program Files (x86)\Java\jdk1.7.0_17)。单击完成。然后返回已安装的 JRE概述删除旧的 JRE 引用选择新添加的 JDK 安装

回答by Peter Lamberg

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

在运行带有 Run-Jetty-Run 插件的 web 应用程序时,我收到了 PWC6345 错误。

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.

修复是更改首选项中的执行环境设置。由于我使用的是 Java 7,因此我需要更改 JavaSE-1.7 的设置。其他执行环境可能会有类似的行为。

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

窗口 -> 首选项 -> Java -> 已安装的 JRE -> 执行环境

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

选择左侧的 JavaSE-1.7 -> 选择右侧的 * jdk*1.7.x_xx

回答by ydntn

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]

下载任何 jdk 并将 JAVA_HOME 指向此 jdk。在这个 jdk 文件夹中,你会发现 ./bin 和 ./jre/bin 从 ./bin 复制 javac 并将其粘贴到 ./jre/bin [记住复制不是剪切]

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.

现在在 eclipse 中,Run->External-Tools->External-Tools-Configurations,在左窗格中选择项目的 build.xml 并单击右窗格中的 JRE 选项卡。单击已安装的 JRE 并添加上一步中的 jdk。完成后,选择这个新的 JRE (jdk1.6.0_31) 作为“单独的 JRE”,点击底部的应用并运行。

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

这假设您在 Eclipse 上使用 ant 执行 jetty:run。

回答by VonC

Strange because this threadsuggests:

奇怪,因为这个线程建议:

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)?

解决方案是安装包 jdk7-openjdk
也许这应该添加到依赖项列表中(或者对于码头,而不是 solr 本身)?

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

但这在 Windows 上没有多大帮助,因为 openjdk7 的二进制文件不容易获得。
(在“适用于 Windows 操作系统的 OpenJDK 可用性”评论中,eckes提到已经找到了一些适用于 Windows 的 openjdk 二进制文件,作为Build b146 的一部分。但是,不再维护所述版本)

The bug reportfilled by the OP Jonasis closed with a simple reference to the Eclipse wiki page "Jetty/Howto/Configure JSP".

OP Jonas填写的错误报告以对Eclipse wiki 页面“Jetty/Howto/Configure JSP”的简单引用结束。

回答by Charestm

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

你们有植物解决方案,但我认为它存在比修复 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.

我遇到了同样的问题,然后我意识到这可能是因为我确实有 64 位的 JDK7,而我应该有 32 位的 JDK7。

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

所以我通过下载和使用 JDK7 for 32Bit 解决了我的问题。

Also, you would still need to

此外,您仍然需要

  • Use the JDK and not the JRE
  • Set your JAVA_HOME
  • 使用 JDK 而不是 JRE
  • 设置你的JAVA_HOME

I am running on Windows by the way ...

顺便说一下,我在 Windows 上运行...

回答by Daniel

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

我也有同样的问题。当我运行时where java,输出是:

C:\Windows\System32\java.exe

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

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.

当然第一个是错误的。所以我的问题在于PATH。我可以通过删除目录 C:\Windows\System32\ 中的 java.exe 来纠正这个问题,因为我确定它没有用,或者将第二个条目放在第一个条目的前面。

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.

所以遇到这个问题时,请检查你的jdk的PATH。我希望我的问题和我的解决方案在某种程度上有所帮助。

回答by amichair

I got the PWC6345 error when running jetty-runner 9.2.1 standalone from Windows 7 cmd (or batch file) with Oracle JDK 1.7.0_60, and none of the other suggestions in this or other forums worked. I'll leave my workaround here, in case it helps someone...

我在使用 Oracle JDK 1.7.0_60 从 Windows 7 cmd(或批处理文件)独立运行 jetty-runner 9.2.1 时遇到 PWC6345 错误,并且此论坛或其他论坛中的其他建议均无效。我会在这里留下我的解决方法,以防它对某人有帮助......

After installing the JDK, running 'where java' showed two different java.exe paths, the first being in the Windows system folder, and the second in the JDK folder (which is the one I added to the path manually). Both of these are actually installed by the same JDK installer. The java.exe in the system folder was taking precedence and causing the full JDK to go undetected.

安装 JDK 后,运行“where java”会显示两个不同的 java.exe 路径,第一个在 Windows 系统文件夹中,第二个在 JDK 文件夹中(这是我手动添加到路径中的那个)。这两个实际上是由同一个 JDK 安装程序安装的。系统文件夹中的 java.exe 优先并导致完整的 JDK 未被检测到。

Placing the JDK bin folder (e.g. "C:\Program Files\java\jdk1.7.0_60\bin") on the path beforethe other system paths fixed the issue.

在其他系统路径修复问题之前,将 JDK bin 文件夹(例如“C:\Program Files\java\jdk1.7.0_60\bin”)放在路径上。

回答by Deep Shah

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

如果您设置了环境变量JRE_HOME,请取消设置或删除它并重新启动服务器。

回答by user7224471

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

在 liferay 7 中:我通过使用 jdk 将服务器的运行时环境从 jre 更改为 jre 来修复此错误