10 Replies Latest reply on Feb 2, 2004 10:09 AM by elaineqs

    ClassCastException on hot redeploy.

    camtabor

      Please excuse the cross-post but this thread is in general discussion and I thought a link should be made from here so we can find out if we are doing something wrong or if there is a bug.

      It pertains to a ClassCastException being thrown after a hot-redeploy. This is pertinent at least through RC2 in my experience and some report it in the alpha CVS as well.

      http://jboss.org/forums/thread.jsp?forum=52&thread=13544

        • 1. Re: ClassCastException on hot redeploy.
          lsloh

          More details about this.

          I noticed that the narrow() on a particular name after hot redeploys fails ONLY if you have accessed the name before the deploy. Other names that were not accessed are can be narrowed without errors.

          • 2. Re: ClassCastException on hot redeploy.
            liejian

            I have also experienced this problem. I am running win2k with the latest verion of jboss as of this posting. It fails at the narrow() method call. Once I restart jboss, it works again. Has anyone come up with a solution yet?

            LJ

            • 3. Re: ClassCastException on hot redeploy.

              Yes.

              Remove jndi.properties from your deployment or
              don't setup an initial context to go over RMI.

              Regards,
              Adrian

              • 4. Re: ClassCastException on hot redeploy.
                katazan

                Adrian,

                I don't deploy a jndi.properties with my project, the problem persists with jb 3.0.4.

                Can you email me with a fix if there is one?

                Thanks,

                JC

                • 5. Re: ClassCastException on hot redeploy.

                  jboss 3.0.5 contains a workaround for the JVM
                  caching of interfaces in jdk 1.4

                  Regards,
                  Adrian

                  • 6. Re: ClassCastException on hot redeploy.
                    gongqin

                    I am having the same problem. I have an EJB wrapped as a web service. The EJB looks up another EJB on a remote server. It works fine for the first deployment. After a hot-deploy, I will get this ClassCastException on the narrow method.

                    I read somewhere that this ClassCastException generally means a class is not found during the narrowing process. Anyone has a solution to this issue yet?

                    I am running jboss 3.0.5.

                    Thanks.

                    • 7. Re: ClassCastException on hot redeploy.
                      gongqin

                      I am having the same problem. I have an EJB wrapped as a web service. The EJB looks up another EJB on a remote server. It works fine for the first deployment. After a hot-deploy, I will get this ClassCastException on the narrow method.

                      I read somewhere that this ClassCastException generally means a class is not found during the narrowing process. Anyone has a solution to this issue yet?

                      I am running jboss 3.0.5.

                      Thanks.

                      • 8. Re: ClassCastException on hot redeploy.
                        dan1

                        As Adrian was saying, remove the jndi.properties.

                        If you do something like:

                        Context jndiContext = getInitialContext();

                        Object ref = jndiContext.lookup("myObjectHomeRemote");
                        myObjectHomeRemote home = (myObjectHomeRemote)ref;

                        I don't think you should have problems.

                        Dan

                        • 9. Re: ClassCastException on hot redeploy.
                          ropeter321

                          Please help! I am having this problem have tried the solutions given. I am not deploying a jndi.properties file and I have taken out the narrow and am just trying to cast the reference. I do not have a problem casting RemoteHome objects, only LocalHome objects. Does anyone have a work around for this on the local side?

                          I am using JBoss 3.0.4 and cannot upgrade to a newer version, but if there is an easy fix in the JBoss code I can change that. Is there?
                          Below is the small bit of code, if you see a problem please advise.
                          Thank you in advance.

                          InitialContext ic = new InitialContext();
                          Object object = ic.lookup("java:comp/env/ejb/LockEJB");
                          LockLocalHome home = (LockLocalHome) object;
                          return home;

                          • 10. Re: ClassCastException on hot redeploy.
                            elaineqs

                            Hi,

                            There is a good solution for this problem ??

                            thanks!