當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
生活随笔
收集整理的這篇文章主要介紹了
maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
idea?通過maven插件創建一個WEB項目通過內嵌Tomcat加載項目,啟動沒問題,一訪問頁面就報錯提示無法將jsp編譯為class文件:
?
HTTP Status 500 -
type?Exception report
message
description?The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the generated java file The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class filesStacktrace:org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)com.atchina.servlet.MyServlet.doGet(MyServlet.java:13)javax.servlet.http.HttpServlet.service(HttpServlet.java:617)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)?
note?The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.
?
錯誤的原因為:tomcat6不支持jdk1.8版本
maven默認使用的是Tomcat6,而我使用的是JDK1.8,Tomcat6不能與JDK1.8一起使用。只要將Tomcat的版本調高就行了。
<build><finalName>maven_web</finalName><pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --><plugins><plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin><!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --><plugin><artifactId>maven-resources-plugin</artifactId><version>3.0.2</version></plugin><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.0</version></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.22.1</version></plugin><plugin><artifactId>maven-war-plugin</artifactId><version>3.2.2</version></plugin><plugin><artifactId>maven-install-plugin</artifactId><version>2.5.2</version></plugin><plugin><artifactId>maven-deploy-plugin</artifactId><version>2.8.2</version></plugin><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version></plugin></plugins></pluginManagement></build>?
然后將maven命令改為Tomcat7:run就行了
總結
以上是生活随笔為你收集整理的maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: maven学习三
- 下一篇: spring26-2: bean的作用域