This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Remote debugging a war file

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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=%SAVE_JAVA_OPTIONS%
with
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.
org.eclipse.jdi.TimeoutException



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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic