JBoss.orgCommunity Documentation

Chapter 22. TorqueBox Additional Resources

22.1. BackStage
22.1.1. Features
22.1.2. More Information
22.2. New Relic
22.2.1. Usage
22.3. VisualVM
22.3.1. Connecting VisualVM to a Local TorqueBox
22.3.2. Connecting VisualVM to a Remote TorqueBox

BackStage is a Sinatra app that you may deploy within TorqueBox to get additional views and control into your application's components.

New Relic is an application monitoring and management tool that provides statistics about and insight into your application. New Relic will work with TorqueBox just like any other Ruby application. There are some minor caveats regarding JRuby which New Relic lists on their FAQ.

VisualVM is a useful tool for monitoring and troubleshooting Java applications. Detailed below are the steps to connect to TorqueBox from VisualVM when connecting to both local and remote TorqueBox servers. More information about VisualVM itself can be found in the Oracle VisualVM documentation. To start VisualVM from the command line:

$jvisualvm

Connecting to a remote TorqueBox server requires a few more steps.

On the remote TorqueBox server, edit $JBOSS_HOME/standalone/configuration/standalone.xml or, if running in a cluster, $JBOSS_HOME/standalone/configuration/standalone-ha.xml and instruct the JMX subsystem to not use the management endpoint and instead use the remoting endpoint for remote JMX connections.


Next we need to add a new application user to the remote TorqueBox server.

$ $JBOSS_HOME/bin/add-user.sh

What type of user do you wish to add? 
 a) Management User (mgmt-users.properties) 
 b) Application User (application-users.properties)
(a): b

Enter the details of the new user to add.
Realm (ApplicationRealm) : 
Username : testuser
Password : 
Re-enter Password : 
What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) : 
About to add user 'testuser' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'testuser' to file '/opt/torquebox/jboss/standalone/configuration/application-users.properties'
Added user 'testuser' to file '/opt/torquebox/jboss/domain/configuration/application-users.properties'
Added user 'testuser' with roles  to file '/opt/torquebox/jboss/standalone/configuration/application-roles.properties'
Added user 'testuser' with roles  to file '/opt/torquebox/jboss/domain/configuration/application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process? 
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cDRzc3cwcmQj" /

Finally, start TorqueBox on the remote server and bind it to a real IP address.

$ torquebox run -b <server_ip>

When running VisualVM on the local machine you'll need to ensure $JBOSS_HOME/bin/client/jboss-cli-client.jar is on the classpath. You can simply copy that file to the local machine or if TorqueBox is installed locally use the jar from inside there.

$ jvisualvm --cp:a $JBOSS_HOME/bin/client/jboss-cli-client.jar

Inside VisualVM, click on File -> Add JMX Connection. The connection string is "service:jmx:remoting-jmx://<remote_server_ip>:4447". Also check "Use Security Credentials" and enter the username / password used in the add-user.sh script.