日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP

發布時間:2025/6/15 javascript 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。