启动tomcat卡在starting状态,然后访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
来源:互联网 发布:淘宝卖家怎么改名 编辑:程序博客网 时间:2024/05/22 03:25
一、问题描述
eclipse通过maven插件创建一个WEB项目通过内嵌Tomcat加载项目,启动没问题,一访问页面就报错提示无法将jsp编译为class文件:
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 1 in the generated java fileThe 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)
错误的原因为:tomcat6不支持jdk1.8版本
我pom.xml文件里明明配置的是Tomcat7啊!! 怎么是tomcat6运行去了。。。
- <project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
- xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”>
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.fendo.sse</groupId>
- <artifactId>com</artifactId>
- <packaging>war</packaging>
- <version>0.0.1-SNAPSHOT</version>
- <name>com Maven Webapp</name>
- <url>http://maven.apache.org</url>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <!– 加入ServletAPI –>
- <!– https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api –>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.3</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <finalName>com</finalName>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>tomcat-maven-plugin</artifactId>
- <version>1.1</version>
- <configuration>
- <port>8080</port>
- <uriEncoding>UTF-8</uriEncoding>
- <url>http://localhost:8080/manager/html</url>
- <server>tomcat7</server>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.fendo.sse</groupId> <artifactId>com</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>com Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- 加入ServletAPI --> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.3</version> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>com</finalName> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.1</version> <configuration> <port>8080</port> <uriEncoding>UTF-8</uriEncoding> <url>http://localhost:8080/manager/html</url> <server>tomcat7</server> </configuration> </plugin> </plugins> </build></project>
注意: 如果你的版本是tomcat7-maven-plugin 2.0 的话,由于它不支持 jdk 1.8,所以把它换成 tomcat7-maven-plugin 2.2就行了。
二、解决方法
找了下发现原来是这里出了问题!!!
把它改为: tomcat7:run 就行了
在maven里自动下载tomcat-embed-core-7.0.47.jar会很慢,建议在网上下载该包,然后复制到仓库下
阅读全文
0 0
- 启动tomcat卡在starting状态,然后访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- maven WEB项目启动没问题访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- org.apache.jasper.JasperException: Unable to compile class for JSP
- “org.apache.jasper.JasperException: Unable to compile class for JSP”
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP:
- org.apache.jasper.JasperException: Unable to compile class for JSP
- org.apache.jasper.JasperException: Unable to compile class for JSP
- 局部敏感哈希(Locality-Sensitive Hashing, LSH)方法介绍
- pipe管道
- PPTP VPN
- 画图神器:plot.ly
- USB信号
- 启动tomcat卡在starting状态,然后访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- 长尾关键词怎么优化?
- iOS
- ffmpeg编程概览
- 用Docker在Ubuntu下 设置一个完整的Python + TensorFlow + GPU support + jupyter notebook + Deep Learning 开发环境
- Rxjava的最简单使用
- 【图像缩放篇之二】二次线性插值和三次卷积插值
- VR系列——Oculus Rift 开发者指南:七、SDK样品和手柄的使用及低级传感器详述
- Maven项目——ego-parent\pom.xml does not exist