We have 2 EARs running on the same Websphere 8.5 Application Server. Each EAR is running in its own classloader. We have a service that initiates a remote EJB call to another service exists in another EAR. Stubs are being generated automatically on startup since WAS 7.
One of our teams tried to perform some clean up that we place in the other EAR that holds our interface in order to have a better isolation in the classpath.
Right after this classpath clean up, we were trying to initiate a remote EJB call, but for some reason it thrown the following exception:
"...ClassCastException...unable to load ..._Stub..."
We didnt understand why this exception came up? why ClassCastException?
After some time, we realized that we had Remote interfaces which were not identical between the EARs and that there were missing classes in classpath. So whenever you have such an architecture, you should make sure that your remote interfaces are identical and you dont have any missing classes in the classpath of the calling EAR.