我们遇到了类加载的一个主要问题.
我们正在尝试进行简单的JNDI查找,并且我们看到以下异常:
Caused By: java.lang.ClassNotFoundException: weblogic.rmi.internal.StubInfoIntf
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1029)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:473)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClassInternal(GenericClassLoader.java:1113)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:1046)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1038)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:473)
at weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:821)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:848)
at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:843)
at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:73)
at weblogic.rmi.internal.StubInfo.resolveObject(StubInfo.java:410)
at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:332)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1148)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2036)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:231)
at sun.reflect.GeneratedMethodAccessor2058.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2136)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2245)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2125)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422)
at weblogic.rmi.extensions.server.CBVInputStream.readObject(CBVInputStream.java:64)
at weblogic.jndi.internal.JNDIHelper.copyObject(JNDIHelper.java:42)
at weblogic.jndi.WLSJNDIEnvironmentImpl.copyObjectViaSerialization(WLSJNDIEnvironmentImpl.java:57)
at weblogic.jndi.internal.JNDIEnvironment$ProxyCopier.copyObject(JNDIEnvironment.java:209)
at weblogic.jndi.internal.JNDIEnvironment.copyObject(JNDIEnvironment.java:51)
at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:433)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:308)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:435)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
现在,这个类:weblogic.rmi.internal.StubInfoIntf与weblogic.rmi.internal.StubGenerator所在的jar相同. (一个显然是找到的,另一个不是)
我已将以下jar添加到%DOMAIN%/ lib:wlthint3client.jar
这包含缺少的类,但它没有帮助.
注1:
重要的是要指出这一点
weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:821)
确实使用不同的类加载器启动查找,这可能解释了为什么找不到类,但是我还需要把jar放在哪里,或者我应该如何配置weblogic类加载它呢?
笔记2
我查找了服务器上包含weblogic.rmi.internal.StubGenerator的所有jar文件.我猜想可能有一个奇怪版本的jar在wlthint3client.jar之前加载并且在中间件或某个地方并导致问题.我找到了4个罐子,所有罐子都包含两个类.
注3:
沿着这条线… stacktrace的一个特定部分引导我到这个代码片段:
private static Class getStubClass(StubInfo info, ClassLoader cl) {
Class c;
try {
c = cl.loadClass(info.getStubName());
} catch (ClassNotFoundException var4) {
c = hotCodeGenClass(info, cl);
}
return c;
}
这不是表明应该捕获ClassNotFoundException吗?我问的原因是因为我看到几个bug在互联网上搜索原因,我看到很多人都在调用hotCodeGenClass.但从来没有在我们自己的堆栈跟踪中.这让我觉得我们正在以某种方式使用一些不同的罐子.
Weblogic版本:12.2.1.3
最佳答案 >抛出的异常是NoClassDefFoundError而不是ClassNotFoundException,这就是为什么没有在该代码块中捕获
>如何在Weblogic中进行JNDI查找抛出NoClassDefFoundError,在Weblogic服务器中有些不好用
>我建议您不要尝试修复Weblogic中的类加载问题,而是安装一个干净的新版本并再次尝试