7 Replies Latest reply on Feb 28, 2012 2:29 PM by aaacaesar

    EJB deploy in JBoss AS

    Duc Le Newbie


      I got a problem when design and deploy my application.


      Assume that my application has N business (N session bean), and when I want to disable a business, I just simply destroy (off) a session bean equivalent.! But I not found the destroy button in JMX-console, but destroy jar deployed button is available ??



      How can I resolve my problem?

      And when I need to change source code of a business, I just redeploy file jar , and press reload... ?

      Can I do that with session bean container in Jboss?


        • 1. EJB deploy in JBoss AS
          Wolf-Dieter Fink Master

          AFAIK there is no option to destroy one SessionBean.


          But if you repack your app you can use the hotdeploy feature (replace the jar/war/ear in deploy directory).

          Your app will be completly undeployed and the new one will start.

          • 2. EJB deploy in JBoss AS
            Duc Le Newbie


            Thank you so much.

            AFAIK Session bean (EJB) was born to make Enterprise application modular, and developing a module is independent to each other. If I want to modify a module is simple and do not disturb any other modules. I though I could off a module, modify this, reload it while the others was still running...

            Could you so me the way to implement this great thing!


            • 3. EJB deploy in JBoss AS
              Wolf-Dieter Fink Master

              As far as I understand the way for you is to pack the EJB's into different JAR files.

              In this case you might able to redeploy one of it.


              But remember that, in case of (declared) dependencies between, JBoss will deactivate applications that depend on the current redeploy.

              If you not declare the dependency within the deployment descriptor I'm not sure what happen, I suppose that the reference to the local EJB interface will become invalid and you have to implement a retry mecanism.

              • 4. EJB deploy in JBoss AS
                Duc Le Newbie

                Yes, from now, I must pack my EJBs into different  JAR files, and all reference to another EJB, I used JNDI lookup instead of @EJB injection (I mean local EJB) also following a retry mechanism. I think this way leak performance of my app ( each operation with another EJB must look up in JNDI server... ) but each EJB is independent to others. Perhaps, I must decide which EJB is modular, not all EJB do .

                Do you think I do it in right way?

                • 5. EJB deploy in JBoss AS
                  Wolf-Dieter Fink Master

                  Sounds good.

                  For performance I would encapsulate the JNDI lookup and store the reference during @PostConstruct and handle it at runtime via method instead of direct variable access.

                  The method might check the reference or you re-lookup only in case of problems with the local-IF.

                  • 6. EJB deploy in JBoss AS
                    Duc Le Newbie

                    Do every JavaEE developer design their app with that way ?

                    (I'm newbie )


                    • 7. Re: EJB deploy in JBoss AS
                      aaacaesar Newbie

                      Don't frown.  I know many experienced developers with  similar questions.  Everyone is on the same path, just not at the same stage.  Better to reach out early in the process and avoid costly mistakes.  I'd be happy to connect you to another community project  around JBoss Enterprise and EJB3.1  Good Luck!