4 Replies Latest reply on Oct 5, 2003 10:29 AM by Eric Devlin

    Redeployment & ClassCastException Part n..

    Wolfgang Koppenberger Newbie

      Problem with Redeployment of EJB. All files (Source & Binaries & build script are attached)

      We are running jboss-3.2.1_tomcat-4.1.24 (default config)

      JBoss: Release ID: JBoss [WonderLand] 3.2.1 (build: CVSTag=JBoss_3_2_1 date=200305041533)
      Java: Java version: 1.4.1_02,Sun Microsystems Inc.


      The demo is a simple servlet that makes a lookup on a Statless Session Bean. (see source)

      1.) use ant to rebuild.
      2.) prebuild versions are available in the /deploy folder
      - test_servlet.war
      - test_ejb.jar

      3.) start JBoss and deploy test_servlet.war and test_ejb.jar
      4.) http://localhost:8080/test_servlet/
      The following output will occour:
      08:51:58,006 ERROR [STDERR] ClassLoader lookup TestHome ----> org.jboss.mx.loading.UnifiedClassLoader3@99176f{ url=file:/C:/Programme/jboss/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/deploy/server/default/deploy/test_ejb.jar/54.test_ejb.jar ,addedOrder=35}
      08:51:58,006 ERROR [STDERR] ClassLoader TestHome in Servlet ----> org.jboss.mx.loading.UnifiedClassLoader3@99176f{ url=file:/C:/Programme/jboss/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/deploy/server/default/deploy/test_ejb.jar/54.test_ejb.jar ,addedOrder=35}

      fine and OK!


      5.) Now make a redeployment of test_ejb.jar without deploying test_servlet.jar
      6.) Call again http://localhost:8080/test_servlet/
      The following output will occour:

      08:53:16,088 INFO [MainDeployer] Deployed package: file:/C:/Programme/jboss/jboss-3.2.1_tomcat-4.1.24/server/default/deploy/test_ejb.jar

      08:53:19,803 ERROR [STDERR] ClassLoader lookup TestHome ----> org.jboss.mx.loading.UnifiedClassLoader3@185e90f{ url=file:/C:/Programme/jboss/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/deploy/server/default/deploy/test_ejb.jar/56.test_ejb.jar ,addedOrder=37}
      08:53:19,813 ERROR [STDERR] ClassLoader TestHome in Servlet ----> org.jboss.mx.loading.UnifiedClassLoader3@99176f{ url=file:/C:/Programme/jboss/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/deploy/server/default/deploy/test_ejb.jar/54.test_ejb.jar ,addedOrder=35}

      08:53:19,813 ERROR [STDERR] java.lang.ClassCastException
      08:53:19,813 ERROR [STDERR] at at.creato.test.web.TestServlet.doGetPost(Test
      Servlet.java:36)
      ....

      How can we solve this problem?

      greetings
      Wolfgang


      As I am not able to attach the zip file containing sources and binaries (zipped 20 kb) i just put it on a server outside... :
      http://www.creato.at/jboss_forum/jboss3.2.x-test.zip

        • 1. Re: Redeployment & ClassCastException Part n..
          Adrian Brock Master

          You must redeploy the servlet because it
          is still holding a reference to the ejb interfaces
          from the previous instances.

          Alternatively, separate the interfaces into a
          separate jar and put them server/default/lib

          That way you can redeploy either implementation
          without worrying about contract redeployments

          Regards,
          Adrian

          • 2. Re: Redeployment & ClassCastException Part n..
            Wolfgang Koppenberger Newbie

            Yes, I know i have to redeploy the servlet... but this we don't want :-)) (jboss 2.4.x you can deploy the ejb without redeploying the ear or war...)

            To put it in the lib is not really a solution, because you kick off the redeployment feature (especially if using clustering...)

            The Problem:
            We have some EJBs and perhaps 20 - 30 different ears using the same business logic... hm...

            So if we redeploy the ebj(s) we have to redeploy all ears... and that's not really the solution.

            At this moment we are using reflection to call the ejbs (so we need not to cast to the corresponding Home and Remote Interface) but if use dataobject as Parameters or Return values -> reflection is not really the solution...

            Perhaps we'll try a hack at the UCL for flushing the interfaces or something like that.

            I just wanna know if somebody had similar problems...

            Thx.
            Wolfgang

            • 3. Re: Redeployment & ClassCastException Part n..
              Adrian Brock Master

              If you want something similar to 2.4,
              you can use a loader repository for each deployment
              and use the ByValueInvokerInterceptor.

              All objects are then serialized between the
              caller and callee. It is much slower.

              The class has already been flushed from the UCL.
              The problem is you webapps are holding onto them.

              Regards,
              Adrian

              • 4. Re: Redeployment & ClassCastException Part n..
                Eric Devlin Newbie

                Adrian,

                I'm using jdk 1.3.1, jboss 3.0.8, tomcat 4.1.24,

                I think I have a similar problem, but it is manifesting itself as a NoSuchMethodException. I thought that if I did an InitialContext.lookup that I would get the latest proxy class which would then allow me to do the reflection correctly. I'm not able to do the reflection unless I start and stop the web app. Does JBoss update the proxies held by the war if not then the only way must be through the ByValueInvokerInterceptor you mentioned above.

                bean deploys
                war deploys
                war refrences bean
                bean redeploys with changed methods
                war goes boom

                Thanks
                Eric