简体   繁体   English

Spring MVC Project的.war文件无法在Jetty服务器中使用JRE进行部署

[英]Spring MVC Project's .war file not able to deploy using JRE in jetty server

  • IDE : STS(Eclipse) IDE :STS(Eclipse)
  • Server : Jetty-distribution-8.1.15.v20140411 服务器 :Jetty-distribution-8.1.15.v20140411

I have created a SpringsMVC Project using Template available in STS tool(New->Springs Project-> Springs MVC Project). 我已经使用STS工具中的模板(新建-> Springs项目-> Springs MVC项目)创建了一个SpringsMVC项目。 I generated a war file(SpringsMVC.war) and placed it in /webapps folder of Jetty server. 我生成了一个war文件(SpringsMVC.war),将其放在Jetty服务器的/ webapps文件夹中。 Now I started Jetty using JRE's 'java' , 现在,我使用JRE的“ java”启动了Jetty,

D:\\jetty-distribution-8.1.15.v20140411> "C:\\Program Files (x86)\\Java\\jre7\\bin\\java" -jar start.jar D:\\ jetty-distribution-8.1.15.v20140411> “ C:\\ Program Files(x86)\\ Java \\ jre7 \\ bin \\ java” -jar start.jar

Now when I tried to access my application in browser, it shows the below error; 现在,当我尝试在浏览器中访问应用程序时,它显示以下错误;

HTTP ERROR 500

Problem accessing /SpringMVCProject1/. Reason:

Server Error
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:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:276)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103)
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:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at     org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)

But if I use JDK's java, war file gets deployed and output displayed perfectly. 但是,如果我使用JDK的Java,则将部署war文件并完美显示输出。

D:\\jetty-distribution-8.1.15.v20140411> "C:\\Program Files (x86)\\Java\\jdk1.7.0_55\\bin\\java" -jar start.jar D:\\ jetty-distribution-8.1.15.v20140411> “ C:\\ Program Files(x86)\\ Java \\ jdk1.7.0_55 \\ bin \\ java” -jar start.jar

Hello world!

The time on the server is August 20, 2014 3:42:53 PM IST.

Please tell is it not possible to use JRE to execute a "SpringsMVCProject"? 请告知是否无法使用JRE执行“ SpringsMVCProject”?

Your JSP pages are compiled at request time and the servlet class that results from that compilation is used to serve requests. 您的JSP页面在请求时进行编译,该编译产生的servlet类用于服务请求。 So javac is needed at runtime. 因此在运行时需要javac

You could precompile the JSPs thereby voiding the need to compile them on the first request. 可以预编译JSP,从而无需在第一个请求时就对其进行编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM