Application scenarios:
Project architecture: Emmbed Jetty + Spring + JSP + Maven.
The project is packaged as a jar package through the maven-shade-plugin plug-in, and run using the command "java-jar xxx. jar.
Note: Install the JRE environment on the server, instead of JDK. If JDK is installed, the access is normal !!!
Maven JSP Configuration:
<Dependency>
<GroupId> org. eclipse. jetty </groupId>
<ArtifactId> jetty-jsp </artifactId>
<Version> 8.1.4.v20120524 </version>
</Dependency>
<Dependency>
<GroupId> javax. servlet </groupId>
<ArtifactId> jstl </artifactId>
<Version> 1.2 </version>
</Dependency>
When you access the page, the following error occurs:
Http error 500
Problem accessing/. Reason:
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
Caused:
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is requiredat 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:643)at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:450)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:542)at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067)at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:377)at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1001)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:271)at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98)at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:643)at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:450)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067)at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:377)at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1001)at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)at org.eclipse.jetty.server.Server.handle(Server.java:360)at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)at java.lang.Thread.run(Unknown Source)
Powered by Jetty ://
After searching for half a day, I still don't understand why. I once thought about whether pre-Compilation of JSP can solve the problem during project packaging and found no corresponding method.
Later I thought it should be about JSP dependency, so I changed the maven configuration:
<Dependency>
<GroupId> org. mortbay. jetty </groupId>
<ArtifactId> jsp-2.1-glassfish </artifactId>
<Version> 9.1.02.B04.p0 </version>
</Dependency>
<Dependency>
<GroupId> javax. servlet </groupId>
<ArtifactId> jstl </artifactId>
<Version> 1.2 </version>
</Dependency>
During packaging and running on the server, no error is reported!
However, you have not yet understood the specific reason.