我在Weblogic中部署应用程序时收到此错误。
<Oct 3, 2013 12:18:00 PM IST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "MyApp" due to error java.lang.ArrayIndexOutOfBoundsException: 4818
8
java.lang.ArrayIndexOutOfBoundsException: 48188
at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:45)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:145)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ArrayIndexOutOfBoundsException: 48188
at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:45)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:145)
Truncated. see log file for complete stacktrace
>
我知道这是因为一个类没有正确加载,但我怎么找到它? 我正在使用Hotspot 1.7,并且使用-verbose:class我无法找出错误加载的类。
这是启用了详细类加载的列表。
[Loaded com.bea.objectweb.asm.FieldVisitor from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.MethodVisitor from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.AnnotationVisitor from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.commons.EmptyVisitor from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm.commons_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.ClassReader from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.Attribute from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded com.bea.objectweb.asm.MethodWriter from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded weblogic.servlet.internal.WebAppInternalModuleExtension$PersistenceExtension from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded weblogic.servlet.internal.WebAppInternalModuleExtension$SpringInstrumentationExtension from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded weblogic.cacheprovider.coherence.CoherenceClusterContainer from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded weblogic.servlet.internal.WebAppInternalModuleExtension$CoherenceCacheExtension from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded weblogic.utils.enumerations.FileEnumeration from file:/C:/Oracle/Middleware/modules/com.bea.core.utils_2.0.0.0.jar]
[Loaded weblogic.utils.classloaders.DirectoryClassFinder$1 from file:/C:/Oracle/Middleware/modules/com.bea.core.utils.classloaders_3.0.0.0.jar]
[Loaded weblogic.utils.enumerations.EmptyFileContainerException from file:/C:/Oracle/Middleware/modules/com.bea.core.utils_2.0.0.0.jar]
[Loaded weblogic.utils.enumerations.FileEnumeration$NullDirectoryListException from file:/C:/Oracle/Middleware/modules/com.bea.core.utils_2.0.0.0.jar]
[Loaded weblogic.utils.enumerations.FileContainer from file:/C:/Oracle/Middleware/modules/com.bea.core.utils_2.0.0.0.jar]
[Loaded weblogic.utils.enumerations.LIFO_FileContainer from file:/C:/Oracle/Middleware/modules/com.bea.core.utils_2.0.0.0.jar]
[Loaded com.bea.objectweb.asm.Type from file:/C:/Oracle/Middleware/modules/com.bea.core.repackaged.asm_1.2.0.0_3-2-0.jar]
[Loaded weblogic.application.internal.flow.ModuleStateDriver$DestroyStateChange from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded weblogic.application.utils.ExceptionUtils from file:/C:/Oracle/Middleware/wlserver_12.1/server/lib/weblogic.jar]
[Loaded javax.management.RuntimeErrorException from C:\Java\JDK\JDK17~1.0_1\jre\lib\rt.jar]
[Loaded com.bea.logging.ThrowableWrapper from file:/C:/Oracle/Middleware/modules/com.bea.core.logging_2.0.0.0.jar]
<Oct 3, 2013 11:51:20 AM IST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "MyApp" due to error java.lang.ArrayIndexOutOfBoundsException: 48188
java.lang.ArrayIndexOutOfBoundsException: 48188
at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:45)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:145)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ArrayIndexOutOfBoundsException: 48188
at com.bea.objectweb.asm.ClassReader.readClass(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at com.bea.objectweb.asm.ClassReader.accept(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:45)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:145)
Truncated. see log file for complete stacktrace
关于如何继续进行的任何提示?
谢谢!
答案 0 :(得分:7)
基本上,它是部署中的错误类文件。有些图书馆有这些。
有什么不对的是,weblogic 12c没有捕获异常并记录罪魁祸首,因此可以找出它是哪一个。我会向Oracle提出这个问题,以便他们这样做。
请参阅similar issue in Geronimo,他们将消息更改为警告,而不是阻止部署。
关于哪个文件可能有问题的提示是in 12c they are loading resource classes as well which they did not do in previous versions,因此如果应用程序在以前的版本中运行,则可能是由于此原因。
至于如何找出它是哪个类,可以将调试连接到weblogic实例并在java.lang.ArrayIndexOutOfBoundsException上添加异常断点,然后尝试检查上下文以找出参数。
答案 1 :(得分:0)
对我来说,这是关于在Spring Bean类的private
方法中使用Java 8流lambda的。 Eclipse IDE中的Weblogic版本-12c,12.1.3)。
我想在Spring 3.1中使用Java 8创建bean时会出现问题。
我有一个Set<String>
,我被要求将其转换为Set<Long>
,为此,当我使用类似strSet.stream().map(s -> Long.parseLong(s)).collect(Collectors.toSet());
,
在部署到服务器时,我开始收到此java.lang.ArrayIndexOutOfBoundsException
。
因此,当我更改代码以在解析后遍历Set<String>
并添加到Set<Long>
时,错误消失了。
这是一个旧版Spring MVC 3.1应用程序,Weblogic Server从JDK 8开始,Eclipse没有显示任何错误,并且Eclipse Project Facet设置为Java 1.8。
答案 2 :(得分:0)
我为繁荣而添加的另一个问题是,它引起了我很多头痛,是与WebLogic 12c捆绑在一起的Spring版本。 WebLogic 12c与Spring 3.x捆绑在一起,并且无法理解带有lambda表达式的Java 8类文件。
一个复杂的因素是,它在开发机器上的本地WebLogic实例上运行良好,但在Oracle Cloud实例上却无法运行。
解决方案是通过在weblogic.xml
目录(WEB-INF
中添加src/main/webbapp/WEB-INF
来告诉WebLogic使用Web应用程序捆绑的Spring版本。 Maven)。
<?xml version="1.0" encoding="UTF-8" ?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<container-descriptor>
<prefer-application-packages>
<package-name>org.springframework</package-name>
<!--
Add other packages that you may want to use
over the ones bundled with WebLogic.
-->
</prefer-application-packages>
</container-descriptor>
</weblogic-web-app>
那为我解决了这个问题。