Enable WebSphere in Debug Mode
- Servers > Server Types > WebSphere application servers
- Under Server Infrastructure section > expand Java and Process Management > Process definition
- Under Additional Properties section > click Java Virtual Machine
- Checked the “Debug Mode”
- In Debug arguments textbox, put this
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=
8888
- Restart WebSphere server instance.
Now, WebSphere is started in debug mode, and listening on port 8888. (Later, Eclipse will connect to this port for debugging)
To create archive
If you are using ant script
Compile your java classes with option debug="true" in your ant script.
|
If you are using eclipse
Before compilation check the option in eclipse for
Window > Preferences > Java > Compiler > Classfile Generation: "add line number attributes to generated class file" should be checked. |
Install or deploy web application to WebSphere
“war” your web application, install (first-time) or deploy it to WebSphere. And start your web application in WebSphere.Eclipse’s Java Debugger (jdb)
In Eclipse IDE, under your project source- Click on “Run”, “Debug Configurations…”
- Select “Remote Java Application”, right click and select “New”
- Renamed a new name , e.g “WebSphere 7 Instance”
- In “Connection Type”, select default, “Standard (Socket Attached)”
- Host, put your WebSphere host IP
- Port, put 8888.
- Click on the debug button.
Debugging
Open your favorite browser, and type your web application URL. Now, Eclipse will stop at your predefined breakpoints.Done.
Know/How
- Local eclipse can block the remote system to run, if it is not disconnected. So, if server is deploying/undeploying the application the all the machine should be disconnected from remote.
- It is always better to use IP address then the machine name in the configuration, because some time debug does not work while using machine name.
No comments:
Post a Comment