zoukankan      html  css  js  c++  java
  • maven项目中出现Unable to compile class for JSP错误的解决办法

    :在maven项目中访问jsp页面的时候,有的时候会出现下面的这种情况:

    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 files

    二:首先需要看下是否加入了下面这两个依赖,没加的话加上去

     1 <dependency>
     2   <groupId>javax.servlet</groupId>
     3   <artifactId>servlet-api</artifactId>
     4   <scope>provided</scope>
     5 </dependency>
     6 <dependency>
     7   <groupId>javax.servlet</groupId>
     8   <artifactId>jsp-api</artifactId>
     9   <scope>provided</scope>
    10 </dependency>

    再然后查看是否配置了如下tomcat插件:

    1 <!-- 配置Tomcat插件 -->
    2 <plugin>
    3     <groupId>org.apache.tomcat.maven</groupId>
    4     <artifactId>tomcat7-maven-plugin</artifactId>
    5     <configuration>
    6         <path>/</path>
    7         <port>8080</port>
    8     </configuration>
    9 </plugin>

    添加了之后若还是出现上面那个异常,可以看下在Run as中的Maven build中输入是不是tomcat:run这个命令,是的话可以改下命令为tomcat+配置的tomcat的版本的版本号,例如配置的是tomcat7的话,那么将命令改成tomcat7:run即可。

  • 相关阅读:
    Spring URL重写
    DOUBLE精度问题
    激光推送一
    log4j打印debug日志问题
    dpkg:处理 xxx (--configure)时出错解决办法,也可用于卸载软件出错的情况
    Ubuntu中配置tomcat
    Ubuntu16.04安装Eclipse
    删除mysql数据库后django重建数据库
    MySQL修改root密码
    django1.9和mysql
  • 原文地址:https://www.cnblogs.com/AI-xiaocai/p/10862738.html
Copyright © 2011-2022 走看看