8 Replies Latest reply on Dec 11, 2003 1:43 AM by rameshs

    Programatically EJB Deploy

    joaocm

      I think that is possible to programatically deploy an EJB jar file by the way of EJB Deployer MBean, is that right ?

      Where I can find some code snippet of this ?

      thanks in advance

        • 1. Re: Programatically EJB Deploy
          • 2. Re: Programatically EJB Deploy
            aaronlippold

            Hi,

            Once I deploy via the MainDeployer is there a way I can have the MainDeployer tell me when the deployment is finished so that I can 'pause' my build process till it is completed?

            • 3. Re: Programatically EJB Deploy
              genman


              Through JMX you can receive MBeanServer notifications. You should be able to see if your EJBs have been registered and started. Find the ObjectName of the EJBs you are installing. Get the MBeanServer and then register a notification listener.

              http://java.sun.com/j2ee/1.4/docs/api/javax/management/MBeanServer.html

              See addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback). One of the notification messages should indicate the EJBs were STARTED.

              • 4. Re: Programatically EJB Deploy
                genman


                By the way, it appears the Ant JMX task doesn't support waiting for notifications, so you'll have to write that yourself. As an alternative you can always poll the state in some sort of loop until the service is up. This sort of thing will have to be written by you.. :-)

                Actually, a state polling loop might be preferable, as the MBean must exist before you can register a notification listener, and the notification itself could happen AFTER you get the notification listener registered.

                • 5. Re: Programatically EJB Deploy
                  aaronlippold

                  Hi,

                  When you say, you'll have to write that yourself, my own inclanation would have been to write a loop that uses the boolean isDeployed() function from the MainDeployer. However, your responce seems to suggest that you may have another approach. If so what would that be?

                  Thanks for the help.

                  Aaron

                  • 6. Re: Programatically EJB Deploy
                    rameshs

                    Hi,

                    I have deployed my ejbs using the MainDeployer MBean and providing a remote URL. But how do I persist these ejbs in the server side?

                    Regards,
                    Ramesh.

                    • 7. Re: Programatically EJB Deploy
                      aaronlippold

                      When you deployed your ejbs using the MainDeployer with a remote URL what port did you specify for the connection and did you have to have a special account setup for the file transfer from machine A to machine B since the mainDeployer is copping your ejb to the remote machine.

                      Can you be a bit more specific on what you mean by, "persist these ejbs in the server side..."

                      Thanks

                      Aaron

                      • 8. Re: Programatically EJB Deploy
                        rameshs

                        Hi,

                        I actually provided an HTTP URL such as http://rameshs:8080/myejb.jar

                        This ejb gets deployed when the JBoss is running. But when I restart the JBoss Server, this ejb doesn't get deployed. So, there are 2 choices for me:

                        1. There is some Scanner MBean in JBoss, where you can provide URLs / directories to be scanned for deployment. I can add my URL to this MBean. But I need to have my web server running constantly at 8080. This would not be feasible as I have started the web server temporarily for deployment alone.

                        2. The MainDeployer can have additional options of persisting the ejb (Saving the EJB jar locally) so that the ejb would automatically deploy even while restarting.

                        I was looking for the 2nd option. Any help would be appreciated.

                        Regards,
                        Ramesh