jetty启动报错:java.lang.ArrayIndexOutOfBoundsException: 24879

一、报错信息

2017-12-01 17:00:02.410:WARN:oeja.AnnotationParser:main: EXCEPTION 
java.lang.ArrayIndexOutOfBoundsException: 47116
	at org.objectweb.asm.ClassReader.readClass(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:908)
	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:771)
	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:764)
	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:764)
	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:764)
	at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:764)
	at runjettyrun.annotation.RJRAnnotationConfiguration.parseClasses(RJRAnnotationConfiguration.java:142)
	at runjettyrun.annotation.RJRAnnotationConfiguration.parseWebInfClasses(RJRAnnotationConfiguration.java:60)
	at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:106)
	at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:459)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1315)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:485)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:108)
	at org.eclipse.jetty.server.Server.start(Server.java:307)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:90)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:58)
	at org.eclipse.jetty.server.Server.doStart(Server.java:274)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
	at runjettyrun.Bootstrap.main(Bootstrap.java:80)

二、错误分析

项目使用jdk版本是1.8,jetty使用的版本是9.0.3;
spring使用的版本是3.0.2;
而项目使用了jdk8的相关特性编写代码;
由于jetty9.0.3和spring3.0.2对jdk8支持不是很全面,所以报上述错误。

解决办法:
1、项目使用低版本的jdk和spring,将jdk版本降低为1.7,spring版本为3.0.2
2、项目使用高版本的jdk和spring,将jdk版本升为1.8,spring版本升为4.0,jetty 版本升为jetty-9.4.6.v20170531

(1)jdk8下载:http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html

(2)jetty-9.4.6.v20170531下载:http://www.eclipse.org/jetty/download.html

(3)pom.xml添加spring4.0的依赖

<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-tx</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.0.6.RELEASE</version>
		</dependency>

(4)部署好环境再次运行项目即可

关注我的技术公众号《漫谈人工智能》,每天推送优质文章

©️2020 CSDN 皮肤主题: 技术工厂 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值