zoukankan      html  css  js  c++  java
  • maven web报错:org.apache.jasper.JasperException: Unable to compile class for JSP

    原博文地址:https://blog.csdn.net/ken1583096683/article/details/80837281

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

    查找了很多文章,原因是jar包冲突,只要在pom.xml中添加下面的依赖就可以了

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2</version>
        <scope>provided</scope>
    </dependency>

      注意:需要放在<dependencies></dependencies>中,不然会报错

    可是问题就来了,我添加了上面的依赖依旧是报同样的错,最后发现是启动的时候存在一些问题
    我用的是Goals: tomcat:run,这样会导致一个问题:尽管我配置的是tomcat8.5,但默认使用tomcat6,而tomcat6不支持jdk1.8版本
    这里就需要添加tomcat7-maven-plugin的插件
    注意:如果你的版本是tomcat7-maven-plugin 2.0 的话,由于它不支持 jdk 1.8,所以把它换成 tomcat7-maven-plugin 2.2就行了
    在pom.xml里添加如下代码:

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

    这样就配置好了,记得把Goals改成tomcat7:run,便可以使用tomcat8.5
    注意:官方并没有tomcat8-maven-plugin,这里只要使用tomcat7-maven-plugin就可以使用tomcat8.5


    原博文地址:https://blog.csdn.net/ken1583096683/article/details/80837281

  • 相关阅读:
    [LeetCode]3Sum Closest
    [LeetCode]3Sum
    [LeetCode]Roman to Integer
    [LeetCode]Integer to Roman
    [LeetCode]Container With Most Water
    [LeetCode]Palindrome Number
    [LeetCode]String to Integer (atoi)
    [LeetCode]Reverse Integer
    Elasticserch与Elasticsearch_dsl用法
    es 查询更新操作
  • 原文地址:https://www.cnblogs.com/hi3254014978/p/12373445.html
Copyright © 2011-2022 走看看