Eclipse/Scala(tra) debugger remote - java

I am running my Scala(tra v.2.3.0) application using ./sbt -jvm-debug 8000 - and get the proper "Listening for transport dt_socket at address: 8000" - followed by container:start. And the container starts, and the app seems to work properly. The JVM used has been set with jenv local oracle64-1.8.0.77.
Now when I go to Eclipse and run my Debug configuration, that is
Connection type: Scala debugger (Socket attach)
Connection localhost, port 8000
Preferred launcher: Scala Remote Launcher
In Scala Debugger tab, "Enable async trace functionality" is ticked
the debugger looks like it is attached, as I get this screen.
However no breakpoint stops, my Variables window is empty, and it looks like a "ghost app".
Any idea about what I could be doing wrong? I seem to have exhausted the usual suspects (but hey, maybe I missed one).

Related

AEM & Eclipse - Remote JAva Application Debug won't run or hit breakpoints, but occupies debug port

I'm running on AEM Perspective with my remote server running. I then run Java Remote Application configuration on port 5402. First time running the debug config, it says it failed. Second time running it it says "Failed to connect to VM. Connection refused."
None of the breakpoints I've set up get hit, or are the icon they're meant to be when debug is running. None of the buttons on the debug view are lit up indicatin debug is actually working. However, eclipse is active as a task for the debug port when I run netstat -ano | findstr :5402 on cmd line.
I have restarted eclipse and AEM about 10 times today trying to get around this as no one on my team is experiencing this issue. I'm new to the tea, though, and all of them have had their environments running for years, so they don't know what step I could be missing that I can't get my env to work like theirs.
This is preventing me from getting work done and is very frustrating. Does anyone know why Eclipse would behave this way?

Gradle should not wait for debugger to attach

does anybody know a way to let gradle run the application in debug mode but not wait until the debugger attachs? I know this is a nice feature to have the debugger attached when the application starts. My google research was not fruitful.
The command I execute to start the application in debug mode.
./gradlew appRunDebug
(which is equivalent to ./gradlew appRun --debug-jvm)
What I see then on the console after several seconds:
Listening for transport dt_socket at address: 5005
<============-> 97% EXECUTING [1m 2s]
At this point I have to attach my debugger to the process in order that the start routine continues. But I just want to have the debug port open and the application fully running without attaching my debugger.
How can this be achived? Thanks for any help. Even the confirmation that this is not possible.
According to https://akhikhl.github.io/gretty-doc/Debugger-support.html, from Gradle 1.1.8 onwards, you should be able to set the debugSuspend property to false and appRunDebug won't start the application in suspended mode.

how to debug a web service in IntelliJ?

Please correct me if I did anything wrong:
I created a web service (WSDL) in Java and it has a method TestCall().
I also created a website http://testwebsite:8000/abc/index.html, and this website is calling the web service in step 1.
I created a remote debugging for it in IntelliJ. I put testwebsite as the host and 8000 as the port number.
Once I went to http://testwebsite:8000/abc/index.html and click on TestCall(), it didn't go to the breakpoint in IntelliJ. When I was trying to remote debug the web service, I got error:
Unable to open debugger port (testwesite:8000), handshake failed, connection permanently closed.
Can someone tell me what steps I missed? thanks
When you need to remotely debug an application, go to the settings (Run->Edit configurations) in IntelliJ.
Now click the + sign and add a Remote configuration. It tells you the command line to add to the startup of the JVM you start on the remote machine. It will be something like:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 for jvm 5-8.
Now you can start your remote web service on the server with these extra command line options. Then you start this configuration in IntelliJ. It will tell you Connected to target VM, address: 'server name', transport: 'socket'. You can add breakpoints as you are used to with local debugging.
As you see: the remote debugging does not use the web-port, but a different port that is opened especially for debugging purposes. If there are firewalls between the server and your workstation, please choose a port that is open, or have the firewall port opened (if possible).

Handshake failed - connection prematurally closed error when debugging Solr in Intellij

So i was going to debug my Solr filter plugins on Intellij Community Edition. After i ran the program from comand prompt with this command
java -jar start.jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8983
I started my Intellij debugger with this config:
Transport : socket
Debugger mode : attach
Host : localhost
Port : 8983
But when I ran the debugger I got this error:
Error running Debugger: Unable to open debugger port (localhost:8983):
java.io.IOException "handshake failed - connection prematurally closed"
Any idea how to fix this?
I got that error when trying to access to debug port on a Docker container.
If you are trying to access the debug port inside a Docker container make sure you are specifying the port as *:5005
E.g.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
This has been changes since Java 9.
See: REGRESSION: Remote debugging does not work on JDK 9
It's not a bug. It's a security.
Before the JDK-8041435
If you have a server with EXT and INT interfaces and start Java process with address=5900 it binds to both interfaces and allow anybody from entire world to connect to your java process unless you block it on firewall.
After JDK-8041435 socket transport try to guess localhost and bind to localhost only. I.e. socket transport by default works only if both client and server are located on the same machine. It's not an easy task to guess proper localhost. so ever same-machine configuration might not work in some situation because of network setup.
You can restore old, insecure behavior using * (asteric)
i.e.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5900
should work exactly as it was before JDK-8041435
But it's recommended to explicitly specify ip address to bind when it possible.
And JDWP socket connector accept only local connections by default
The JDWP socket connector has been changed to bind to localhost only if no ip address or hostname is specified on the agent command line. A hostname of asterisk (*) may be used to achieve the old behavior which is to bind the JDWP socket connector to all available interfaces; this is not secure and not recommended.
It should be something like this,
java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8983" -jar start.jar
it's working now
I had this error with OpenJDK 11 inside Docker container and setting environment variable JAVA_DEBUG_PORT to "*:5005" worked for me.
You forgot to specify -Xdebug on the java command line.
Edit: As in
java -jar start.jar -Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8983
It has helped me, at least in Intellij IDEA:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0.0.0.0:5005
try to add ip 0.0.0.0.

Error while running webapplication with google appengine

I created a small web application.if i deployed its work but if try to run application it show
the port 8888 appears to be in use(perhaps by another lanch),do you still to contine with this lanch? i clicked yes
but show the error
Could not open the requested socket: Address already in use: bind
Try overriding --address and/or --port.
The problem is what it is stating.
You are facing this issue because of the following:
Either the port 8888 is in use by some other application and not previous launch. This is less likely.
This condition is more likely and it is because you have already launched the application once i.e. via the Run as Web Application. And it is still running. In your Eclipse, visit the Window-> Show View -> Console. And in the Console window, you will find one or more previous instances running. Please stop that.
There are some instances where the solution suggested by Romin will not work because the option to stop the process does not present itself in the console.
In these cases, you can probably find out which process ID is using the port and then kill that process.
For example, on a mac, this worked for me:
😈 >lsof -i tcp:8888
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 25866 alexryan 60u IPv6 0x96e9c26778f105e1 0t0 TCP localhost:ddi-tcp-1 (LISTEN)
😈 >kill 25866
😈 >lsof -i tcp:8888
😈 >
The port number 8888 is in use means that port already been activated. do one thing go to servicees option of control panel set the server start option from automatic to manual. Then your apps will get run. else you can stop the server from your eclipse env stop option.

Categories

Resources