4 Replies Latest reply on Mar 6, 2002 12:58 PM by jules_gosnell

    ClassCastException when SessionTimeout

    mredeker

      I am holding a EJBHandle in a java bean which implements HttpSessionBindingListener. When I logoff my application normally I invalidate the HTTPSession and the 'valueUnbound' method is called. In that method I call getEJBObject on my handle and do some method call on my EJB and then I call remove on my EJB. So far everything is fine.

      If my HTTPSession is invalidated because of a timeout 'valueUnbound' is also called but I get a ClassCastException when I want to cast my EJBObject to my real remote interface.

      From what I can see is that the check if a timeout is reached is running in a separate Thread.

      Is it possible that the separate Thread has a different ClassLoader which causes the Exception?

      Thanks,
      --Marcus

        • 1. Re: ClassCastException when SessionTimeout
          jules_gosnell

          If you are using RH HEAD (with Jetty), then the answer is "YES".

          I hadn't thought of this.

          TimeOuts are run on a shared background thread to save stack.

          I could either run a separate thread per webapp instance - expensive, or cache a reference to the classloader with each timeout and reset it when I run the timeout???

          I'll think about it.

          Thanks for bringing this to my attention.


          Have you tried theis on Tomcat (standalone or with JBoss?). What behaviour do you see ?


          Jules

          • 2. Re: ClassCastException when SessionTimeout
            mredeker

            Jukes,

            We are currently using JBoss 2.4.4 with Tomcat 4.0.1. So it seems that Tomcat has the same problem as Jetty. Do you know if there is any quick solution to that. We are planning to go 'live' with this in about a month or so.

            Thanks

            Marcus

            • 3. Re: ClassCastException when SessionTimeout
              mredeker

              Jules,

              Sorry I spelled your name wrong in the reply before.

              Marcus

              • 4. Re: ClassCastException when SessionTimeout
                jules_gosnell

                OK,

                I've checked a fix into the Jetty integration to handle this.

                I would be interested to hear if this works for you, and any other problems that prevent you from using Jetty over TomCat.

                As far as TomCat goes, it's a 3rd-party app with no particular affiliation to JBoss. If you need a bug fixed you will have to approach that project on bended knee.

                Sorry I can't be of more help.....

                Jules

                P.S.

                If you are feeling daring, fix TomCat and run on that if they won't take your changes back.


                P.P.S.

                It is for exactly this sort of reason that JBoss ships with Jetty by default. The Jetty community is determined to make the JBoss/Jetty integration a success by integrating the two as tightly as possible and resolving problems thrown up by this integration ASAP. You would not have had to wait the time that you have if my monitor had not blown up and my laptop battery given up the ghost.....