3 Replies Latest reply on Nov 24, 2003 2:00 PM by Eric Devlin

    [Cactus] ClassCastException after hot deployment

    martin_kersten Newbie

      Hi beloved forum,

      I am bothered by a strange class loader problem - At least, I guess it's a class loader problem. I am using an test case to test an CMP Entity Bean. The problem occures on the cast after the lookup. It does not matter wether I am using the local or remote interface.

      Here is the code:

      public void setUp() throws Exception {
      javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
      Object object=initialContext.lookup(BeanHome.JNDI_NAME);


      The code works well if the server gets started and deployed the bean. But after redeployment (using hot deployment), the cast to BeanHome after narraw took place, throws an error. The reason of this is simple. The lookup uses a diffrent version of the BeanHome class (the one created by the last deployment) and the test case uses the old version (the one of the first deployment). Therefore it seams to be a classloader problem.

      If I don't perform a test before redeployment took place, the code will still work those the BeanHome class was not loaded.

      Question: Does anyone know a solution on that issus?



      PS: I am using JBoss 3.2.2 and Cactus 1.5+.