org.apache.jasper.JasperException: Unable to compile class for JSP

我也遇到了这样的问题,这样的问题主要是由于你配置的环境变量的原因所造成的我们来看一下造成这种情况的主要原因:
很明显他说:org.apache.jasper.JasperException: Unable to compile class for JSP
意思是不他不能够完成类的编绎,造成他的的原因是我没有正确配置我的vm,在这里我提前说一下我的这个项目在手动启动Tomcat的statup.bat文件的时候是没有任何问题的,出现问题的原因是我用eclipse中的Tomcat启动时出现的,从这里就可以看出确实是我的vm设置的不正确所造成的,经过的查找我发现我在编绎这个项目的时候我用的vm是1.4的(从这里可以查看【Window】->【Preferences】->【Java】->【Compiler】->【JDK Compliance level】->1.4)而在启动eclipse中的tomcat的时候他让tomcat用的vm是eclipse自身带的vm我的eclipse是5.5.1的从这里可以看出他应该是用的1.5的vm(从这里可以查看windows -> preference ->AplicationServers-> tomcat -> JDK-> Tomcate JDK name )因此部题就水落石出了,我们只要么让这两个编绎器相同就可以了。

额外补充一点就是刚才我们费的那老半天的劲就是为了一个目的让他能够用的tools.jar这个工具,困为Tomcat在工作的时候就主要是用这个工具来进行编绎的,所以你如果不用eclipse来启动tomcat的话一定要让tomcat能够找到这个文件,也就是你要在你的环境变量中设置对让你的JAVA_HOME的路径正确。(tool.jar是在你的java的lib目录下的)

posted on 2008-12-09 12:03 丁克设计 阅读(88665) 评论(12)  编辑  收藏 所属分类: 常见错误解答

评论

# re: org.apache.jasper.JasperException: Unable to compile class for JSP[未登录] 2011-12-01 16:03 柠檬

严重: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:


Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
不是配置环境变量的错。我找了好久的错误了  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2012-04-19 19:15 fei

Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 7 in the generated java file
Syntax error on token "import", Identifier expected after this token

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.jsp.dologin_jsp._jspService(dologin_jsp.java:114)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2012-04-27 19:28 chenxm

你网站做的很漂亮  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2013-03-12 19:15 521

我的也出现了这个错误,一直找不到问题所在,你的问题解决了吗?是怎么解决的啊@柠檬
  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP[未登录] 2013-03-28 15:15 ws

也许是你在js文件中导入了一个不存在的类!  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2013-04-30 17:09 大梨

好郁闷找了好久啦,问题还是在  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP[未登录] 2013-05-13 12:45 小白

很有用,赞一个  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP[未登录] 2013-06-04 21:28 XH

235541 [http-8080-Processor17] ERROR org.apache.jasper.compiler.Compiler - Error compiling file: /F:/workspace/V7.1/YLtamin/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/cvbs//org/apache/jsp/bss/custct/payment\Payment_jsp.java [javac] Compiling 1 source file

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError


我也出现了上面的问题 一直报错。。。  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2014-04-01 21:22

你是怎么解决的@柠檬
  回复  更多评论   

# org.apache.jasper.servlet.JspServletWrapper.service 2014-04-28 23:56 11

1  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP[未登录] 2015-06-17 16:57 Dream

@ws
那如何导入自己所定义的类呢?应该将自定义的类放在Eclipse创建的JavaWeb工程的那个文件中?一般JSP页面中的自定义的类运行时首先会去工程的哪个目录中寻找?  回复  更多评论   

# re: org.apache.jasper.JasperException: Unable to compile class for JSP 2015-08-15 23:14 子灏

tomcat 下,work目录的内容都删除下,试试。  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

导航

留言簿(6)

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜