We are having a major issue with class loading.
We are trying to do a simple JNDI lookup and we see the following exception:
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)
Now, this class: weblogic.rmi.internal.StubInfoIntf
is in the same jar where weblogic.rmi.internal.StubGenerator
resides. (one is obviously found, the other is not)
I've added the following jar to %DOMAIN%/lib: wlthint3client.jar
This contains the missing class but it does not help.
NOTE1:
Its important to point out, that
weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:821)
Does indeed initiates the lookup with a different class loader, which might explain why the class is not found, but where also do I need to put the jar, or how should I configure weblogic class loading for it to work?
NOTE2
I've looked up all of the jars on the server that contain weblogic.rmi.internal.StubGenerator
. I guessed maybe there is a weird version of a jar that is loaded prior to wlthint3client.jar and is in middleware or somewhere and causes the issue. I found 4 jars, all of which contained both classes.
NOTE3
Along this line... A particular part of the stacktrace lead me to this code snippet:
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;
}
Should this not indicate that ClassNotFoundException should be caught? The reason I'm asking is because I saw several bugs searching for the cause on the internet and I saw hotCodeGenClass being called in many of them. But never in our own stacktrace. That makes me think we are using some different jar somehow.
Weblogic version: 12.2.1.3
I was eventually able to find the issue:
Basically the same as:
Just replace jndi with rmi accordingly.