0

enter image description hereenter image description here

I want to build and remote debug an SOA based CDI java application running on a Linux VM from Windows desktop using IntelliJ Idea. What is the most efficient way to do this so that it relieves me from manually transferring (sftp) the application, set up for remote debugging, etc?

I don't want to exit my IDE but would like to debug the application on a remote machine by modifying the app repeatedly. I would like to see the results in the IDE console window/web browser as applicable.

I used the remote debugging option in Intellij IDE, In run/debug configuration option I used Listen to remote JVM and start the debug in IntellijIDE.

I then run the following command in VM Linux:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005  com.intel.podm.rest.RequestValidationFilter


enter image description here In Intellij IDE the command line arguments are dynamically updating to

-agentlib:jdwp=transport=dt_socket,server=n,address=DESKTOP-52V2CBR:5005,suspend=y,onthrow=,onuncaught=

Lalitha9
  • 1
  • 4
  • Does [this answer](https://stackoverflow.com/a/42392922/104891) help? – CrazyCoder Jun 27 '19 at 04:34
  • If am running the command from VM Linux ,java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 com.intel.podm.rest.RequestValidationFilter ,Its displaying Listening for transport dt_socket at address: 5005 Error: Could not find or load main class com.intel.podm.rest.RequestValidationFilter – Lalitha9 Jun 28 '19 at 07:41
  • See https://stackoverflow.com/a/42200519/104891 for the details how to make a working jar with the main class and the dependencies. – CrazyCoder Jun 28 '19 at 07:44
  • I created a artifact ,infact the jar created in IntelliJ under .idea --> artifacts --> SW_jar.xml,wheni imported to linux the jar is in form of .xml format,need a jar file to debug from linux. – Lalitha9 Jul 02 '19 at 07:10
  • Artifact is stored in the output directory, see https://www.jetbrains.com/help/idea/artifacts.html. – CrazyCoder Jul 02 '19 at 07:18
  • Finally i created jar by following file-> project structure->artifact->choosing MANIFEST under resources file ,as i followed https://stackoverflow.com/questions/1082580/how-to-build-jars-from-intellij-properly for building jar,finally the jar created and i start to debug in Intellij and my Java application running in Ubuntu.After running the below command the result was java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 -jar SW.jar Listening for transport dt_socket at address: 8787 Error: Could not find or load main class com.test still am getting another error – Lalitha9 Jul 03 '19 at 08:28
  • Make sure the main class is specified correctly in the jar manifest. – CrazyCoder Jul 03 '19 at 08:39
  • error returning for com.test while creating a jar i selected all modules and libraries ,still it is checking for com.test. yes the main class is included in module – Lalitha9 Jul 03 '19 at 09:16
  • Share the [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) to get further help if you can't figure out what's the problem. – CrazyCoder Jul 03 '19 at 09:16
  • a partial fix done by https://stackoverflow.com/questions/24190769/how-to-connect-intellij-to-a-remote-wildfly-server,and created a gradle configuration to debug,perhaps when debug clicks all the threads are initiating and loading ,doesnt hitting any code.Do any body knows how to create a "Run/Remote" Configuration IntellIj,please let me know – Lalitha9 Jul 12 '19 at 08:37
  • Do any body knows how to create a "Run/Remote" Configuration IntellIj,please let me know – Lalitha9 Jul 12 '19 at 10:03

1 Answers1

0

This is fixed by opening SSH on Linux and remote debug in Intellij,and port number changes in standalone.sh script as project is based on wildfly server builded in gradle build environment. Step 1: open a remote debug step 2: ssh targetMachine@10.10.10.10 –L 8888:127.0.0.1:8787

If your application is in different machine try to create SSH tunnel for example: ssh targetMachine@10.10.10.10 –L 8888:127.0.0.1:8787 Where targetMachine@10.10.10.10 is target user and address. 8888 is the local port where is IDE 8787 is debbuger port in the targetMachine (you can check that port in standalone.sh script)

Lalitha9
  • 1
  • 4