JBoss – Examples of twiddle

The twiddle utility that ships with JBoss is quite powerful. However, one has to struggle to find examples of how to use it.

After trying a bunch of things, here are examples of some of the command that were quite useful for me:

Deploy a WAR/EAR

twiddle.sh -s localhost invoke "jboss.system:service=MainDeployer" deploy "file:///Users/indy/Desktop/railo-jboss1.local"

Undeploy a WAR/EAR

twiddle.sh -s localhost invoke "jboss.system:service=MainDeployer" undeploy "file:///Users/indy/Desktop/railo-jboss1.local"

Add an Alias for a Web Context

twiddle.sh -s localhost:1499 invoke "jboss.web:host=a1,type=Host" addAlias railo-jboss1.local

Find Aliases for a Web Context

twiddle.sh -s localhost:1499 invoke "jboss.web:host=a1,type=Host" findAliases

I also saw the following three resources and found them quite useful:

4 thoughts on “JBoss – Examples of twiddle”

  1. Good article thanks. But i was looking at another example of accessing the http connector bean/ajp connector bean from twiddle ? Do you have any idea how to invoke that ?

  2. Manoj, have you checked if you can do something like that from the jmx-console? Normally twiddle commands can be quite easily recreated based on the path you take in jmx-console to do a task.

  3. Hi,
    Tried to deploy EAR file using the above method and it prints “NULL” as output. I did check the JBoss logfile, and could see just one liner and no activity:

    Command used:
    ./twiddle.sh -s ko-sled10 invoke “jboss.system:service=MainDeployer” deploy “file:///home/rpatel/riskwrite.ear”

    In log file:
    2010-03-03 12:58:09,578 INFO [org.jboss.deployment.MainDeployer] (RMI TCP Connection(528)- deploy, url=file:/home/rpatel/riskwrite.ear

    Can you help me please?


  4. twiddle is great, not only for existing mbeans, but also for invoking / checking of custom mbeans.

    I have had problems with using just -s “servername” before, so specify –server “jnp://server-name:1099”.

    use the following to check status (e.g. to check the amount of active sessions on jboss.web) – twiddle.sh get “mbean” property

Comment on this blog post...