OK, I'm close, but not done. I've put stuff in branches - if you actually svn co
these two branches, build them the normal way and run them, you will see the problem I
describe below. I'm hoping someone can give me some insight into this if possible
First, the branches are:
RHQ:
http://svn.rhq-project.org/repos/rhq/branches/AGENT_PLUGIN_CLASSLOADING/
Jopr:
https://svn.jboss.org/repos/jopr/branches/INSTANCE_CLASSLOADERS/
If you run a JbossAS 5 instance, deploy the Jopr branch's plugins and then run the RHQ
branch's server and agent, you will notice that this line from the jboss-as-5 plugin:
RemoteProfileServiceConnectionProvider [line: 98]:
profileService = (ProfileService) lookup(initialContext, PROFILE_SERVICE_JNDI_NAME);
produces a ClassCastException. It is trying to cast an AOP dynamic proxy (that is a proxy
to the interface of ProfileService) and its telling me it can't cast to
ProfileService. But it should be able to.
I have a very bad feeling about this. Like the ProfileService interface class was loaded
in one class loader, but the ProfileService interface used by the proxy was loaded by
another classloader.
While at a breakpoint at line 98, I confirmed that the same classloader instance is
returned by a) the current thread's context classloader, b)
this.getClass().getClassLoader() (that is, this RemoteProfileServiceConnectionProvider
instance) and c) ProfileService.class.getClassLoader(). So that's all goodness.
Haven't figured out yet the classloader of the AOP proxy's interface (can't
get to it from the debugger).
I haven't had a chance to delve any deeper other than to actually find this problem
(I've solved many other problems just to get to this point). I'll try to do so
this weekend, but I was hoping maybe someone saw this kind of thing before or knows the
problem?
John