views:

168

answers:

1

If I use the web based administrative console for JBOSS, I can navigate to Applications - EJB2 JARs and see a list of deployed EJBs. By clicking on one of these, I get a page that allows me to start and stop the selected EJB. However, I cannot find a command line equivalent. Is there a way to start/stop EJB apps in JBOSS via the command line?

I am going to use Appistry CloudIQ Manager to deploy and manage apps and I need to be able to script the start and stop of individual EJB's. I have found how to install and uninstall via command line, just need to be able to start, stop and query its status (started/stopped).

+1  A: 

If you want to manage JBoss through script you should probably use twiddle tool. More info here: http://community.jboss.org/wiki/Twiddle.

If you want stop WAR application you can make something like that:

  • list WAR application and their bean name:
twiddle.sh query 'jboss.web.deployment:*'

jboss.web.deployment:war=/ROOT
jboss.web.deployment:war=/admin-console
  • turn off application:
twiddle.sh invoke 'jboss.web.deployment:war=/ROOT' stop
  • turn on application
twiddle.sh invoke 'jboss.web.deployment:war=/ROOT' start

Unfortunately I cannot find some similar resolution for EJB application. You can find such application using these command:

twiddle.sh query 'jboss.j2ee:*'

And later you can try stop or start some application. Unfortunately it doesn't work for me correctly.

But you can always undeploy and deploy such application. You can make it such way:

  • deploy
twiddle.sh invoke "jboss.system:service=MainDeployer" deploy file:///path/to/ProjectEAR.ear 
  • undeploy
twiddle.sh invoke "jboss.system:service=MainDeployer" undeploy file:///path/to/ProjectEAR.ear 

Deploy

twiddle.sh invoke "jboss.system:service=MainDeployer" deploy file:///path/to/ProjectEAR.ear 

But it you have to remeber about such things:

  • if you use hot deploy (HDScanner service) you cannot put application in deploy directory (it will be automatically deploy after undeploy)
  • If your application is not in deploy directory then server doesn't install it during start and you have to install it by hand using twiddle command
Lukasz Stelmach