if (c == null) {
c = findClass(name);
}
if (resolve) {
resolveClass(c);
}
return c;
}
return super.loadClass(name, resolve);
}
Listing 2
Doing work with Server A:
initializing queue connection
java -cp jmsinterop.jar;d:\wls5.1\lib\weblogicaux.jar
com.wldj.paston.interop.DualWLSJMSClient
d:\bea\wlserver6.1\lib\weblogic.jar
t3://localhost:9001
d:\wls5.1\sp10\lib\weblogic510sp10.jar;d:\wls5.1\classes
t3://localhost:7001
looking up queue connection factory
initializing queue connection
sending 'Testing'
sent 'Testing'
received 'Testing'
closing objects
Done
Doing work with Server B:
looking up queue connection factory
sending 'Testing'
sent 'Testing'
received 'Testing'
closing objects
Done
Listing 3
final ClassLoader oldContextClassLoader =
try {
final Properties jndiProperties =
jndiProperties.put(
jndiProperties.put(
final Context jndiContext =
final QueueConnectionFactory
// ... more JMS work ...
final Thread thread = Thread.currentThread();
thread.getContextClassLoader();
thread.setContextClassLoader(
isolatingClassLoader);
new Properties();
Context.INITIAL_CONTEXT_FACTORY,
initialContextFactory);
Context.PROVIDER_URL,
providerURL);
new InitialContext(jndiProperties);
queueConnectionFactory =
(QueueConnectionFactory)jndiContext.lookup(
"javax.jms.QueueConnectionFactory");
}
finally {
thread.setContextClassLoader(
oldContextClassLoader);
}