I've just started experiencing this problem, too. If I do a restart it goes away, but any attempt to hot deploy a jar or ear file causes my first attempt to do a context lookup to get a home interface causes a ClassCastException. This started happening out of the blue on one machine I work on, so I switched to another - it took about an hour to start happening on that one as well. A bit mysterious! Anyone else having this, or have any suggestions?
You're using PortableRemoteObject.narrow() in your code?
No, we are just casting since we're using local interfaces - but we tried it with the same results - ClassCastException. Only after a hot deploy, however...
What version are you using? I have no problems (other than PRO.narrow()) when hot deploying beans with local interfaces -- however I redeploy the entire EAR file. Are you redeploying individual EJB jars? Are you caching references to home proxies in your code for instance?
We're using jboss-3.0.4_tomcat-4.0.6. We've tried deploying a jar (for a thick client application) and an ear (for a web app) with the same results. We are caching home references in our code, but the problem isn't on using the cached homes, but on getting the home the first time after a hot deploy - and that only for entity beans, which are local interfaces - the session facade for the entity works fine.
One interesting thing is that before attempting the cast or narrowing method we print out both the class and the class' hashCode to make sure we've actually got an instance of that class before trying to cast or narrow - on the initial (non-hot deploy) attempt they both say that the class name is the same, as is it's hashCode - on the second (hot deploy) attempt they have the same name but different hashCodes. Not sure what that means, but it might point to something....
(Did post a me-too reply earlier but it seems to have disappeared.)
Has anyone come up with a solution?
I have the same problem when working with a EJB jar file and a WAR file for my webapp, but if I run a webserver outside of JBoss (i.e. JBoss runs only for EJB container and a tomcat/jetty webserver in other process) they work correct, the hot deploy wotk fine.
But if run ejb container and web container both inside a one jboss server, the system throws ClassCastException.
Redeploy the war when you redeploy the ejb,
it is holding a reference to ejb interfaces
from the previous deployment.
I had the exact same problem with
after upgraded to jboss-3.0.6_tomcat-4.1.18, the problem has gone away.
Hope it helps.
I had the same problem with jboss-3.0.4_tomcat-4.1.12, but it seems to have gone away after I upgraded jboss to jboss-3.0.6_tomcat-4.1.18.
Hope it helps
Compile the source code of the JBOSS on your machine and then use it. Do not use the binary version