I'm using Jboss 3.0.3 under RedHat 7.3 and I'm facing many classcastexception(s) problem during hot deployment. Here are the problems :
First case :
A session Bean packaged in a jar file (let's call it A.jar) is calling another session bean packaged in another jar file (B.jar) . Works great.
If I hot-deploy B.jar, then the same call raises a "ClassCastException $Proxy..." when getting the home reference :
EJBHome myHome = (EJBHome)InitialContext.lookup("testBean");
The solution is to hot-deploy A.jar, then everything works fine... until the next redeploy.
Second case :
In fact it is a same problem, but with war files getting references to bean in ejbjar. If the war file or the ejbjar is redeployed, then a ClassCastException $Proxy.. occurs during the JNDI lookup.
Here is what I tried :
- I know that Jboss 3.x uses a new classloading architecture, so I removed all duplicate classes from my packaging without success : same classcastexception(s) when hot deploy.
- I had all necessary ejb external references in my ejb-jar.xml,jboss.xml, jboss-web.xml but no difference.
- So next I tried the following trick which solved the second case (war calling an ejbjar) : I put all necessary client jars (taken from jboss/client/ directory) in the WEB-INF/lib directory of my web applications, and Home And remote interfaces packaged in client-jar too, with a jndi.properties file.
I switched the Jetty classloading flag to "false" (witch means that Jetty is using its own classloader first and then delegates to the general classloader) and now I'm able to hot redeploy my war files without any problems. But I know this is not a good solution because my web applications are acting as they were in a seperate VM(RMI calls...)
I tried also the following configurations :
- JDK 1.3.1, 1.4.0, 1.4.1, and Jrockit 7.0.
- moving from Jboss 3.0.1 to 3.02 and now 3.0.3
I just cant figure out why things are so hard to get working with Jboss 3.x when it was very easy with Jboss 2.4.x (hot deployment was simply... rocking !).
Any advice is greatly appreciated...