As you already know JBoss 7.1 is released. It is great, it has still many open bugs, but I like it a lot 🙂
If you want to debug your application, which is running on JBoss 7, then you should run JBoss in debug mode. This is very easy. Open a GNU/Linux terminal and execute these commands:
$> cd /path/to/jboss7/bin $> export JAVA_OPTS="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" $> ./standalone.sh -c standalone-full.xml
JAVA_OPTS already set in environment; overriding default settings with values: -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n ... Listening for transport dt_socket at address: 8787 ... 22:32:45,730 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 2907ms - Started 168 of 244 services (75 services are passive or on-demand)
OK, server started in debug mode. Now, you have to deploy your application to JBoss 7.
You can deploy your application to JBoss 7 using the new CLI tool (which is really cool):
$> cd /path/to/jboss7/bin $> ./jboss-cli.sh [disconnected /] connect [standalone@localhost:9999 /] deploy /path/to/your/app.war
Check that your application is started and the go to next step.
You can connect your Eclipse (I use Indigo) on debug port (8787) of JBoss and debug your application within Eclipse. Follow this Eclipse path using your mouse 🙂
- Run -> Debug Configurations… -> Remote Java Application -> Right click -> New
- Then on Connect tab, set these Connection Properties:
- Host = localhost
- Port = 8787
- Then select your Project and in Source tab add extra projects or libraries.
- Press Apply button
- Press Debug button
- You are connected!!!
- Add a Breakpoint in your code
- Trigger your application to reach a Breakpoint
- Voila 🙂
Happy hacking 🙂
Democracy Requires Free Software
I ran across your blog while looking for content for DZone’s Javalobby (java.dzone.com) and was wondering if you would be interested in having some of your recent posts republished on our site. If so, please send me an email so I can provide some more information.
Thanks for this post:)
Yes it does have many bugs … so what about debugging the Application Server itself ! ?
This kind of dive (into the heart of jboss code) was my first deep dive in the world/code of a big enterprise software. I believe it helped me a lot to become a better software engineer and also teach me to write code with imagination. The first dive in jboss code was many years ago and I really appreciate these guys. I believe they open a door to java proprietary software and I really thanks these guys.
I know that JBoss 7 still has many bugs, but I know that guys there are working on them very hard.
Your proposition may be one of the best exercises to become a better engineer.
Thanks for the post but it does not work on Jboss 7.1.1.Final under Mac OSX 10.8.x with Java 7
I have already used this option on JBoss 7.1.1.Final with Java 7 and it works.
I do not own a Mac, but this should not be related.
Check out the final options that your java process run.