• Post Reply Bookmark Topic Watch Topic
  • New Topic

Remote debugging a war file  RSS feed

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First of all, I want to ask you if I can debug a war file ?

I got some online materials that explain how to debug in a remote machine but doesn't exactly explain if this happens with war file or not.

So here is the way I had implemented :

1. Created a project in Eclipse, added all dependencies and made sure no error occurs.

2. Installed web logic and deployed the above project's war file ( The way I generated war file is , added all java class files, web.xml and libraries in the respective WEB-INF and lib folders -> This part should work fine because I had done for other program and tested it, which worked fine).

3. Went to mydomain\bin\startWebLogic.cmd replaced
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n %SAVE_JAVA_OPTIONS%

4. Went to debug configurations had gives the specific project, host as localhost, port as 8453.

My firewall is turned off.

So I don't exactly know the process, do I need to start my WebLogic and once it is in debugged state do I need to change startWebLogic.cmd as mentioned in point 3.

Because, if I do it early I am getting the below error :

starting weblogic with Java version:
Listening for transport dt_socket at address: 8453
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode)
Starting WLS with line:
C:\Oracle\MIDDLE~1\JDK160~1\bin\java -client -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n -Djava.compiler=NONE -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=256m -Dweblogic.Name=AdminServer -Djava.security.policy=C:\Oracle\MIDDLE~1\WLSERV~1.1\server\lib\weblogic.policy -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8453,server=y,suspend=n -Xverify:none -Djava.endorsed.dirs=C:\Oracle\MIDDLE~1\JDK160~1/jre/lib/endorsed;C:\Oracle\MIDDLE~1\WLSERV~1.1/endorsed -ea -da:com.bea... -da:javelin... -da:weblogic... -ea:com.bea.wli... -ea:com.bea.broker... -ea:com.bea.sbconsole... -Dplatform.home=C:\Oracle\MIDDLE~1\WLSERV~1.1 -Dwls.home=C:\Oracle\MIDDLE~1\WLSERV~1.1\server -Dweblogic.home=C:\Oracle\MIDDLE~1\WLSERV~1.1\server -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1211\profiles\default\sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe101\profiles\default\sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_manifest_classpath weblogic.Server
Error occurred during initialization of VM
agent library failed to init: jdwp
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.

It is clear, that it is taking the default port and listening to it, again if it tries to read from my startWebLogic.cmd it is showing the error.

Question 2
: I started my weblogic in debugging mode, and opened the url for the testing the deployed war file(which means the war file in remote is running) ,went to debug configuration in Eclipse and given hostname and port as localhost and 8453 and clicked on "Apply"

I get the following error :
Failed to connect to remote VM. Connection refused.
Connection refused: connect

For any other port number also I am getting the above error.

If I change the port number to 7001
I get the error as :
Failed to connect to remote VM. Connection timed out.

Please help me out. I don't know if I can do it for war file or not? If not can you exactly explain the steps for a remote machine?
Posts: 3015
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the startup command following "Starting WLS with line:", you'll see that the debug options appear twice. That's what the error message is complaining about, and probably why you can't attach to the remote VM. You'll need to change your startup script so it doesn't duplicate those options.
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Websphere We did remote debugging, But weblogic I am not sure.

steps for websphere Remote debugging.

Remote Machine( Websphere server running Machine)

1.War file is deployed and server is up and running.

2. Go to Web Sphere admin console there we have debug service, select the debug service check box and note down the DEBUG PORT number(ex 7080).

3.Restart the Server in Debug mode.

local Machine

1.In eclipse war file is deployed and correct all the compile errors.

2. in eclipse Debug configuration

host name : remote Machine IP address
port Number : DEBUG PORT number (ex. 7080) should be same with remote Machine DEBUG PORT Number.

3. hit the remote server (http://<ip address>:<port Number>/...)

DEBUG PORT Number and application access port number may not be same.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!