I setup my remote WebLogic server to debug, using these options:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=${DEBUG_PORT},server=y,suspend=n -Djava.compiler=NONE"
I started WebLogic on the server and saw that it was listening on 8453 for dt_socket. I added the remote server on my local Eclipse and tested the connection. I also see that the server is STARTED and I can view the details. However, I'm unable to restart in DEBUG. I also stopped WebLogic on the server and now in Eclipse I see that it is stopped, but I'm not able to start it (the icons for debug and start are greyed out). When I set up my Remote Java Application in Eclipse I did check "Allow termination of remote VM".
Before stopping the server, the debug icon wasn't disabled and when I clicked it I got this message:
Cannot attach to remote server.
Please make sure the server myserver.com is running and listening for transport dt_socket at address: 8453
Failed to connect to remote VM. Connection refused.
Connection refused: connect
Instead of using java startup options, modify the following scripts:
setDomainEnv.sh -> make sure DEBUG_PORT is set ie. 8453
startWebLogic.sh -> set PRODUCTION_MODE=false and set debugFlag=true
Restart server, remote debug should work on port 8453.
Related
I have a java application running on an openshift remote cluster and I want to debug the app from my local machine with Intellij-Idea. The app is built by a Jenkinsfile on another remote jenkins server (gradle build, docker build and pushed to openshift, where it is automatically deployed).
The Dockerfile exposes port 9009 and therefore my Intellij Remote Debug Config looks like this:
Debug Config
With the localhost in the Debug Config I need openshift port-forwarding:
oc port-forward my-pod 9009
Forwarding from 127.0.0.1:9009 -> 9009
When I start the Debugger I get the following error in Intellij:
Error running 'DTC Remote Debug':
Unable to open debugger port (localhost:9009): java.net.ConnectException "Connection refused: connect"
At the same time the terminal with the port forwarding shows:
Handling connection for 9009
E0927 09:52:33.711817 5996 portforward.go:331] an error occurred forwarding 9009 -> 9009: error forwarding port 9009 to pod ad370...c010, uid : exit status 1: 2019/09/27 03:52:33 socat[129691] E connect(5, AF=2 127.0.0.1:9009, 16): Connection refused
Doing an Nmap scan against the url where I get the index.html of my application I got the following:
nmap -sS my-openshift-url
Starting Nmap 7.80 ( https://nmap.org ) at 2019-09-27 15:01 Mitteleuropõische Sommerzeit
Nmap scan report for my-openshift-url (IP-Address)
Host is up (0.0043s latency).
rDNS record for IP-Address: dispatch-my-domain
Not shown: 997 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
9009/tcp closed pichat
Nmap done: 1 IP address (1 host up) scanned in 6.10 seconds
I guess the problem is the closed 9009 port, but I have no clue how I can open that port on my openshift cluster. I already set several environment variables in the openshift web UI (just to be sure):
DEBUG TRUE
DEBUG true
DEBUGGING TRUE
DEBUGGING true
JAVA_DEBUG TRUE
JAVA_DEBUG true
JAVA_DEBUG_PORT 9009
But I can't get it to work. If I switch the port-forwarding to 8080 I can access the index.html via localhost:8080 from my browser. I don't know if I need to change something in the project code (gradle, docker, jenkins, etc.) or if I can just open the port on the deployed service in openshift somehow...
If anything isn't clear or if I missed something just tell me. I'm happy for every piece of advice.
Regards,
Christoph
Adding the following environment variable in openshift did the trick:
JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n
All the other environment variables from above are absolete...
I'm trying to remote debug a standalone java application. I have done all that was recommended by IntelliJ, that is to add and edit a remote configuration on IntelliJ and added the recommended parameters:-
agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
But when I run the debugger I get Unable to open debugger port:
java.net.ConnectionException "Connection refused: connect"
Is there anything I need to on application side:that how will the application know on which port to attach to?How can I make my application listens on the specified port?
I've been following this tutorial which is how to setup remote debugging.
I have my Jar running debug mode listening on port 6065 on my server with the following setting:
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
I start the JAR on my server with jar in debug mode with:
myApplicationThatContainsJar.exe -debug "my application"
> Now Starting JVM
> Listening for transport dt_socket at address: 6065
I have psping tool installed which I use to ping (IPaddress:port). I am able to ping my ipaddress example: 44.66.33.66:6065 from my dev box and get a reply. But when I try to initiate remote debug in Eclipse I get:
Failed to connect to remote VM. Connection refused. Connection
refused: connect
I have verified I've added permission for both inbound and outbound traffic for that port on both my DEV box and server.
When I start my JAR on my server and before I try to connect with Eclipse I do a:
psping 44.66.33.66:6065
And I get a response stating that it sent and recieved with 0% loss, meaning I am indeed getting a response.
In the eclipse debug configuration, which in the 'Debug Configurations' window I have the host and port listed properly and the 'Connection Type: Standard(Socket Attach)'.
As soon as I try to connect with Eclipse and get the connection refused error I try psping again from the command line, but now eclipse did something to the connection and I get in the command line:
The remote computer refused the network connection.
Any suggestions where else I should check? or where else I should troubleshoot? I'm trying to do remote-debugging for my JAR from the DEV box to my server.
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=n
should be:
-Xrunjdwp\:transport\=dt_socket,server\=y,address\=6065,suspend\=y
notice the suspend\=y keep in mind I need to escape the equals and others may not need to do this. Once I set to suspend\=y the application waited for me to connect from eclipse and I was able to begin remote debugging.
Don't forget to open inbound and outbound traffic for the port you used for address\=6065
Check network setting in VM and set Attached to: Bridged Adapter
Check VM IP using ipconfig command
Run Java Application using following command
> java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
Above command myapp replace to your application name
In eclipse go to debug configuration -> remote java Application -> New
Host: remote VM ip
Port: given port that given in command
Apply -> Debug
i'm using Glassfish 3.1.2.2 and Eclipse Kepler.
Glassfish configuration:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009.
Debug: Enabled
Into Eclipse, in the Remote Java Application i've selected the project, and in the connection properties i've set:
Host: localhost
port: 9009
When i try to connect the debug, the message error is:
Failed to connect to remote VM. Connection refused.
Connection refused: connect
I've checked the port 9009 with a telnet, and is not used...
can someone help me?
tx
[SOLVED] it's a problem with the glassfish plugin in Eclipse! you must to start glassfish form the command line, not from the Eclipse window. After, you can connect like remote debug to your local glassfish ;)
In Host, you need to give IP address of the remote machine you want to connect.
localhost is your own machine.
I'm trying to initiate a remote debugging session on my PC with Eclipse & Tomcat.
I managed to run tomcat (not through eclipse) with the following params:
set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=5050
cataline jpda start
The server starts ok, this is the outcome:
Using CATALINA_BASE: "C:\Java\Tomcat"
Using CATALINA_HOME: "C:\Java\Tomcat"
Using CATALINA_TMPDIR: "C:\Java\Tomcat\temp"
Using JRE_HOME: "C:\Java\jdk1.6.0_27"
Using CLASSPATH: ...
Listening for transport dt_socket at address: 5050
...
...
INFO: Server startup in 12502 ms
Now, I opened eclipse, and loaded the relevant project.
I set a new debugging configuration using Remote Java Application with localhost and the right port. however when I run it, I get this error message:
Failed to connect to remote VM. Connection refused.
Connection refused: connect
Can't really understand where is the problem. this is all local inside the PC, so there shouldn't be any firewalls involved, can someone think of something ?
Found the solution. apparently the connection was made, but Eclipse & Tomcat don'tt show any notification or status regarding it.
Then, when you initiate the connection again, you get the error because you're already connected.
I think that a small notice, either from Eclipse, or from Tomcat would be nice.
Try adding the following debug options directly to the JVM startup by directly modifying the catalina startup script
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5050
There could be problems when there are code mismatches between eclipse and tomcat. So when it matches the error will disappear
You can configure it in remote java application section in debug configuration.
For more details you can refer this link