启动报错 数组下标越界 ???

老飞的天空 发布于 2018/04/23 13:05
阅读 1K+
收藏 0

【华为云1024程序员节·向云而生】预约直播 抽14件华为电子产品礼包!>>>

运行环境

 java 1.7 , centos,tomcat7.0  

今天启动的时候报了一个错误,说是 加载  BnbOrderDetailServiceImpl.class   文件的时候 下标越界  ; 错误内容如下 :

搞了老半天也没看出这个文件有什么问题; java进程杀了n次,  也重启了n次; 重新复制了一个tomcat 出来 再把本地的代码上传上去也报同样的错;

最终是把 这个文件给删除掉就好了; 这就更有点无厘头了, 服务器上没有了这个文件,启动不报错,相关的业务也没有影响,

接着尝试将 本地的那个文件夹下的这个文件也会删除掉,得到的结果是会启动报错的; 

不知道有哪位大神遇到过这个问题;请帮忙解决下(应用 以前都是有这个文件运行的,现在是没有这个文件在运行)

 

2018.04.23 12:11:23.017 [localhost-startStop-1] ERROR [org.springframework.web.context.ContextLoader.initWebApplicationContext:350] - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/home/t2/panan/webapps/ROOT/WEB-INF/classes/com/forhome/babyshop/plugs/bnb/service/impl/BnbOrderDetailServiceImpl.class]; nested exception is java.lang.ArrayIndexOutOfBoundsException: 54914
        at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:311) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:272) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:87) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1411) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:172) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:142) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:613) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:514) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5118) [catalina.jar:7.0.79]
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634) [catalina.jar:7.0.79]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) [catalina.jar:7.0.79]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) [catalina.jar:7.0.79]
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) [catalina.jar:7.0.79]
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) [catalina.jar:7.0.79]
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296) [catalina.jar:7.0.79]
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038) [catalina.jar:7.0.79]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_79]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_79]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_79]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_79]
        at java.lang.Thread.run(Thread.java:745) [?:1.7.0_79]
Caused by: java.lang.ArrayIndexOutOfBoundsException: 54914
        at org.springframework.asm.ClassReader.<init>(ClassReader.java:198) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.asm.ClassReader.<init>(ClassReader.java:168) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.asm.ClassReader.<init>(ClassReader.java:441) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) ~[spring-core-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:287) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE]
        ... 36 more

 

 

 

 

 

 

加载中
0
开源中国首席冒牌君
开源中国首席冒牌君

我在你的错误信息中没有发现报你们代码的错误位置,是不是你在注入bean的时候有问题

老飞的天空
老飞的天空
这个下标越界感觉应该是spring容器实例化这个对象到java虚拟机的时候发现有多个这个类; 但是spring的报错也不应该报这个错;而且java 进程也都kill 过的;还是对源码的了解不够啊
老飞的天空
老飞的天空
注入的地方没有问题, 我现在想不明白的是我把这个class文件删掉了,项目才能跑,刚好和我预想中要的效果相反,而且整个项目中只有一个这样的类;
0
老飞的天空
老飞的天空

最终的原因是因为 :

项目采用分层结构 , maven管理, 具体的 是分为 common 层 service 层, controller 层, 前面两个在编译后后打包成jar包,在引入到controller 中, 而之前同时上传的是用没有用jar包方式上传的,common,service 都是class 文件的形式直接上传的,导致项目里面有两份 相同的common,service 的class 文件, 直接删除我打的 common.jar 和 service.jar 就好了,

返回顶部
顶部