activemq
activemq copied to clipboard
Fix class loading issues for SSL/nonSSL connectors
- This resolves issues loading SSL and nonSSL RAR connectors in Glassfish 3.x
- proposed fix for AMQ-5873
Not sure if this is the correct way to solve the problem. The patch incorporates what we've done internally to resolve the issue, which has existed since at least 5.8.x. We mentioned this issue to Johan at one point.
Let me know if the proper way to fix this is to derive our own StandaloneObjectFactory-variant and install via the FactoryFinder.setObjectFactory(). It seems as though the thread-local class loader is succeeding but causing cast exception in downstream code instead of failing and dropping through to the normal class loader.
See Jira issue AMQ-5873 (https://issues.apache.org/jira/browse/AMQ-5873) for stack trace as was reported internally.
Oh classloading is not fun, if this is merged then it may break something on other systems.
Agree with Claus, this shouldn't be merged without a better understanding of the root cause. I'm not following how this would fix the problem. Perhaps in Glassfish an undesirable class is being loaded first via the TCCL? Or perhaps a service locator issue, or a mis-match of ActiveMQ jar versions.
The current code falls back to the class's classloader if the TCCL does not find the class.
Closing old PR without any recent activity. If this is still relevant it can be re-opened.