How to Troubleshoot Apps for the Modern Connected Worker
CRaSH the shell for the JVM
1.
2. An extensible command line for
the JVM
Julien Viet Alain Defrance
Senior software engineer Software engineer
eXo Platform eXo Platform
@julienviet @alaindefrance
3. @julienviet @alaindefrance
10 years of Open Source 2 years of Open Source
■ eXo Platform 2008 ■ eXo Platform 2010
■ Red Hat 2006 Various
■ JBoss 2002 ■ Develop social product
Various
■ Portal stuff (JBoss / GateIn)
■ JCP a while ago
3
4. Project
Open source LGPL: http://www.crashub.org
CRaSH 1.0 – April 2012
CRaSH 1.1 – August 2012
CRaSH 1.2 – Soon (in release candidate)
5. What/Why?
CLI are still relevant
Ubiquitous
Expressive: find . -name “*.java” -exec grep julien {} ; -
print
Made for us
Trends: NoSQL, MS Powershell, Drupal, Jenkins, Cloud,
etc…
Fun!
6. Comparison with UN*X shell
Same client interface But hosted by JVM
■ History ■ Java threads
■ Completion ■ JVM access
■ Command Line Editing
■ Options & Arguments
■ Pipes
6
7. Usage
Runtime modes Get it from
■ Standalone ■ crashub download
■ Embedded (web app, Spring, ■ Maven Central dependency
…)
■ Attach
7
15. Extend your runtime
Embed CRaSH in a Spring web application
Connect using remote protocol
Develop a command to access Spring beans
Add options and arguments to the command
19. Wrap up
Multi facet, powerful and extensible
Reach us
crash-users@googlegroups.com
@crashub
http://www.crashub.org
Hackergarten hands on coding Tuesday
In this part we will show you what you can get withCRaSH out of the box:1/ install crash2/ run crash3/ basic commands : system properties + thread ls
1/ where to download crash2/ how to install standalone3/ standalone layout4/ run standalone5/ single word command : help6/ composite commands7/ system propls8/ filtered system propls with completion9/ thread ls + group + nameA/ thread top
1/ attach to JBoss AS2/ JDBC example3/ JPA example
1/ attach to Jboss AS72/ use log command to show we are executing in AS7 context3/ browse JNDI + filters4/ jdbc open + info + tables + table + select + insert5/ jpa entities + entity + select + where
1/ take an existing command and clone it2/ show some real time stuff3/ program the Twitter command
1/ deploy spring based in tomcat2/ spring ls3/ create commands and display service4/ get twitter from service5/ format output with print6/ turn script into commands with option and parameters
1/ introduce more advanced CRaSH concepts : dashboards Command pipes Aggregation & Streaming
1/ attach to tomcat with visualvm2/ jmx find to list everthing3/ jmx find with filters to get mbean subset4/ jmx get to retrieve statistics5/ jmx sort6/ put command in dashboard7/ add thread ls filtered to retain http threads and jvm ls8/ put load on server