3 Replies Latest reply on Apr 8, 2005 10:06 AM by spoonman464

    EJB deployment problems

    Jason Price Newbie

      We have a EJB project that contains about 10 EJBs that are common to most of our web and client applications. As the EJB are generic, so to speak, this is packaged and deployed as the only thing in the ear file. Everything works fine except for when we need to change any of these EJBs and redeploy. When we redeploy, everything appears to redeploy properly but the webapps then start generating class cast exceptions and the only way to fix it is to restart jboss. This happens on our single jboss server and the 10 clustered machines we have (running jboss4.0.1sp1 on gentoo with one the machines set-up as loadbalancer using mod_jk and apache).

      Is this expected behaviour?
      What is standard practice for this sort of common code. I am at a loss as to how we can deploy to a live enviroment without any impact on the users and client applications. I thought that this is what hot deployment is all about but it doesn't seem to work.

      BTW all the EJBs are stateless session beans that just provide glue between web apps/clients and the Business Classes (using Data Factory pattern).

        • 1. Have you tried redeploying the web apps, too?
          spoonman464 Newbie

          I find that whenever I redeploy an EJB-JAR, any web apps that had already been using those EJBs also need to be redeployed. I don't know the true technical reasons for it but it seems pretty consistent to me.

          If it's true, the reason why it all seems to work after restarting the JBoss server is that restarting undeploys and redeploys everything.

          Maybe you could try redeploying the EAR with the EJBs, try a web app that fails, redeploy that one web app to see if it begins working and then you'll have your answer.

          There might be some way to deal with this problem without redeploying the web apps but I haven't found one yet.

          Spoon

          • 2. Re: EJB deployment problems
            Vishal Sharma Expert

            This is the classical classloading problem disccused in JBoss Admin Guide under section.
            2.2.2.1. ClassCastExceptions - I'm Not Your Type

            It says and solution is provided.

            This type of error is common when redeploying an application to which other applications are holding references to classes from the redeployed application. For example, a standalone WAR accessing an EJB. If you are redeploying an application, all dependent applications must flush their class references. Typically this requires that the dependent applications themselves be redeployed.

            An alternate means of allowing independent deployments to interact in the presence of redeployment would be to isolate the deployments by configuring the EJB layer to use the standard call-by-value semantics rather than the call-by-reference JBoss will default to for components collocated in the same VM. An example of how to enable call-by-value semantics is presented in Chapter 5, EJBs on JBoss


            I hope this helps.

            • 3. Excellent answer!
              spoonman464 Newbie

              Nice work, Vishal. I will give that a try. Just like everything else in J2EE, there's probably some downside to going this route. I'll check out the doc but do you know of anything 'bad' about using this technique?

              Spoon