Debug your Plug-In

You may be the best developer of the planet, sometimes looking at what’s going on on the server still is the fastest option to figure out what’s wrong. Here is how to configure WebSphere in order to debug the Java code of your plug-in (we are talking about ICN service extension) in eclipse.

Enable debug in WebSphere

WebSphere Application Server actually relies on the standard remote debug from Java, meaning the -Xdebug option. It is so simple and so great at the same time. So the only step you have to follow is including the following java options to your server. And for this no need to edit script files in an obscure folder, just go the the WAS console (https://host:9043/ibm/console) in

Servers > Server Types > WebSphere application server  > server_name >  Java and Process Management > Process definition > Java Virtual Machine

Check Debug mode and enter these options:

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

You can choose any port you want instead of 8888. Then restart the server:

/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ server1
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/ server1

Open the port in iptables

Of course don’t forget to open the port you chose in iptables 🙂

iptables -I INPUT 5 -i eth0 -p tcp --dport 8888 -m state --state NEW,ESTABLISHED -j ACCEPT
service iptables save

Create the Remote debug configuration in Eclipse

Just click the small arrow next to the debug icon, create a new Remote Java Application and enter the project containing the source, host and port. Then launch the debug, it should connect with success, place you debug breakpoints and go into your favorite player play with your plug-in in Content Navigator and Eclipse should intercept and stop on your breakpoints!



Leave a Reply