Share interface classes using the same classloader on J2EE/Weblogic 10, without using the system classpath
I have a "framework" running on a Weblogic 10.0 (or 10.3) appserver, where the framework consists of multiple enterprise apps, each responsible for a different resource adapter. A client application gets deployed into the domain, uses JNDI to obtain reference to one of the resource adapter Connector classes, does its invocations and everyone is happy.
The ancestors left me with interface classes for the Connectors and else on the system classpath - this works fine.
The new requirement is to eliminate "polluting" the system classpath, with as low arch开发者_StackOverflowitectural impact as possible. I tried the WLS-specific "shared J2EE libs", but had to see that although I can package the interface classes to a library and reference them in other apps, the classes are still loaded by the separate app classloaders, and this way I get a ClassCastException when I try to cast the JNDI-lookup'd object into the interface.
What do you suggest to do know? Currently I would advise clients to use a separate domain for this framework with system classpath entries, but not sure they would accept it.
Thanks!
Ok, I will conclude then that this is not possible. I think a proper solution would be to rewrite the application to use remote EJB invocations for inter-app communication.
See also Need help understanding JNDI and a particular ClassCastException in J2EE
精彩评论