问题
I'm trying to remote debug a clustered Web Application that is deployed on WebLogic 12c.
I know how to setup remote debugging for normal (non-clustered) environments, I just add the following parameters to the file named [startWebLogic.cmd]:
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
But when I try to set those same parameters on all the nodes of the cluster environment, and then start the cluster using WebLogic console page, remote debugging will not work!! (Eclipse will not be able to connect).
I suspect this is caused by the way the Node Manager of WebLogic starts the individual nodes, it's like it's not calling [startWebLogic.cmd] for each node.
回答1:
I figured it out!
When you start the cluster nodes through WebLogic console page, The node manager handles the start-up of each node in some way, so it does not run each node's [startWebLogic.cmd] file!
I found that you can set remote debugging arguments for each node through the console page itself, so that the node manager will pass those parameters to each node when it attempts to start it.
Below is how I did that (Edit: on WebLogic 12c):
- Open WebLogic console page (e.g: localhost:7001/console)
- On the left side of the page, go to Environment > Clusters
- Find the name of your cluster environment and click on it
- In the "Configuration" tab, open the "Servers" sub-tab
- At the bottom of the page, you'll find a table of all the cluster nodes you have.
- Click on one of the nodes (servers).
- In the "Configuration" tab, open the "Server Start" sub-tab
- Scroll down a bit and you'll find a Text Area named "Arguments", fill it with the remote debugging arguments: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
- Click "Save", and repeat steps 6-8 on all the other cluster nodes.
And you are done!
回答2:
Enable Debugging on the WebLogic Server
In order for the JDeveloper debugger to debug an application deployed to WebLogic Server, the server must be started in debug mode. WebLogic Server debugging is based on the Java Platform Debugger Architecture (JPDA). Note: We are using the domain wl_server, to deploy and debug the provided application.
To start WebLogic Server in debug mode, you will need to modify the startWebLogic.cmd script in the \wlserver_10.0\samples\domains\wl_server directory. is the directory in which WebLogic 10.0.1 was installed into.
In the startWebLogic.cmd script, specify the JAVA OPTIONS with:
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n
The -XDebug parameter enables debugging. The -Xnoagent parameter disables the default sun.tools.debug debug agent. The -Xrunjdwp parameter loads the JPDA reference implementation of JDWP. Debugging is enabled on port 4000. The JDWP protocol is the protocol used to debug with a remote debugger.
来源:https://stackoverflow.com/questions/29237033/how-to-setup-remote-debugging-on-weblogic-clustered-environment