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

51,551

Solution 1

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

Solution 2

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.

Solution 3

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

Solution 4

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.

Solution 5

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.

Share:
51,551
Jonas
Author by

Jonas

Passionated Software Developer interested in Distributed Systems

Updated on November 18, 2020

Comments

  • Jonas
    Jonas over 3 years

    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)
    
  • Jonas
    Jonas over 12 years
    But I use Jetty and Jetty don't have a bin/asadmin-file, and no asenv.bat. I have looked in some configurations files but haven't found anything about the JSP compiler.
  • VonC
    VonC over 12 years
    @Jonas ok, I have found another suggestion, this time for jetty, not glassfish ;)
  • Jonas
    Jonas over 12 years
    I'm on Windows and jdk7-openjdk sounds like a Linux package. I use JDK7 on Windows (see my JAVA_HOME) and I think "Open JDK" is the default for Java 7. Anyway, thanks for all suggestions.
  • VonC
    VonC over 12 years
    @Jonas: a linux package: but openjdk is quite different from the Oracle distribution: openjdk.java.net, And it is available on all OS included windows for openjdk7: stackoverflow.com/questions/5991508/…, except the comment of that post (java7developer.com/blog/?p=55) seems to point out back to Oracle...
  • VonC
    VonC over 12 years
    @Jonas: so my point was that your error might disappear if you use an openjdk instead of an Oracle JDK (even on Windows), but I haven't yet found that openjdk on the Oracle site.
  • Jonas
    Jonas over 12 years
    I discovered that my JSP works fine if I export the project in a war file and deploy it externally. So it seem to be a problem with the Jetty WTP plugin for Eclipse that I'm using.
  • VonC
    VonC over 12 years
    @Jonas: interesting. If you figured it out completely, you can post an answer it (and accept it as the official one)
  • Jonas
    Jonas over 12 years
    I haven't figured out it yet. Exporting as a war-file is clumsy. I filed a bug to the Jetty WTP project, but it was closed immediately :(
  • VonC
    VonC over 12 years
    @Jonas: strange, they keep referring you to wiki.eclipse.org/Jetty/Howto/Configure_JSP...
  • VonC
    VonC over 12 years
    Excellent feedback. +1. I keep my answer below for reference, even if it doesn't directly apply in your case.
  • jsDebugger
    jsDebugger over 11 years
    for jetty 6 and below this would work, not for version above 6, it seems that jetty 6 + version cannot find the JDK for compiling jsp.
  • Jonas
    Jonas over 11 years
    @jsDebugger: if you look at the screenshot again, you see that this is for Jetty 8.1
  • Ben Zuill-Smith
    Ben Zuill-Smith almost 11 years
    Excellent! I was hoping for a non-hackish way around the problem and this was it!
  • DiscDev
    DiscDev over 10 years
    For people using embedded Jetty and don't have a start.ini to edit, simply set this system property before you start your Jetty server: System.setProperty("org.apache.jasper.compiler.disablejsr1‌​99", "true");
  • Shamseer
    Shamseer almost 9 years
    This is perfect answer to this question.
  • vikifor
    vikifor almost 8 years
    This helps me... Thanks a lot:)))
  • Fuhrmanator
    Fuhrmanator about 7 years
    This also fixed my issue when running from the command line (Git Bash). Here's what it looked like for me: $ where java, C:\ProgramData\Oracle\Java\javapath\java.exe, C:\Program Files\Java\jdk1.8.0_131\bin\java.exe -- you can alternatively run the SECOND java (the JDK one) by launching jetty with it by specifying its full path, or using the $JAVA_HOME variable to get there if you've defined it.