IDEA的maven web項目啟動后報錯:The server encountered an internal error () that prevented it from fulfilling this request.


1.出現上述問題描述的原因有很多,我這里的具體原因描述是:

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

2.在網上查找出現該異常的原因,發現是我的jdk和IDEA的tomcat插件不匹配,我用的是Goals: tomcat:run,這樣會導致一個問題:盡管我配置的是tomcat 9.0,但默認使用tomcat6,而tomcat6不支持jdk1.8版本,這里就需要添加tomcat7-maven-plugin的插件 

注意:如果你的版本是tomcat7-maven-plugin 2.0 的話,由於它不支持 jdk 1.8,所以把它換成 tomcat7-maven-plugin 2.2就行了

在pom.xml中的<build><plugins>中加入以下代碼即可!

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
</plugin>

3.把Goals改成:tomcat7:run,運行成功!

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM