Unable to attach remote debugger to app in PCF - java

I have multiple applications running in PCF and can remote debug in to all but one of them. I use the same configuration making sure that
JBP_CONFIG_DEBUG: {enabled: true}
is properly set and picked up by the app.
I run cf ssh -N -T -L 8000:localhost:8000 in command line and verify in PCF Apps Manager that the ssh session is established.
When I run the debug session in Intellij I get the error in Intellij.
Unable to open debugger port (localhost:8000): java.net.SocketException "Connection reset"
And this error in CMD.
connect to localhost:8000 failed: ssh: rejected: connect failed (dial tcp 127.0.0.1:8000: getsockopt: connection refused)
I can ssh into the app with cf ssh with no issue.
I am not sure what the problem is or if there is something I am missing, but this same process work for the other applications.
Any help would be great.

Related

Intelli J IDEA Unable to open debugger port (localhost:8787): java.io.IOException "handshake failed - connection prematurally closed"

I am trying for remote debugging a java test file in intelli J IDEA.But i am getting following error.
Error running 'test': Unable to open debugger port (localhost:8787):
java.io.IOException "handshake failed - connection prematurally
closed"
I have seen solutions of editing command line argument, but it does not allow in 2019.2(ultimate edition).
Below is my configuration.
please help.
The java command that is running in the container needs to have the following parameter, together with any other parameters already there.
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8787
When the image for the container is created, port 8787 needs to be exposed by adding the following line in Dockerfile:
EXPOSE 8787
When you create the container, you need to specify that port 8787 should be tunneled to your docker host. If you are using docker-compose add the following under the specific container section:
ports:
- '8787:8787'
If you are using docker create the parameter is --publish=8787:8787.
If all this has been setup correctly it should now be possible for the debugger to connect to localhost:8787.

IntelliJ - Remote debug - Unable to open debugger port

I am using IntelliJ 2017.3 with Payara 4.1.2.172. I used to just start the server from the command line had a Remote Debug running on port 9009, and everything used to work fine.
Then I set up an plugged in server with attached modules in IntelliJ, to enable HotSwap. I run this server in debug mode, and it works fine.
Now, if I don't use the plugged in server, but want to start the server as previous, when I run the debug remote, I get the following:
Error
Error running 'Debug Glassfish OSM': Unable to open debugger port
(localhost:9009): java.net.ConnectException "Connection refused:
connect"
I have run a netstat and there's nothing running on port 9009.
Question
How do I get the remote debug working on the server?
More info
The domail.xml has:
<system-property name="JAVA_DEBUGGER_PORT" value="9009"></system-property>
And in the server-config JVM Settings:
More info
I set the above 'Enable' checkbox to on, but now I get the following error when I try start the server, i.e. the server won't start now. (netstat shows noting running on port 9009)
ERROR: transport error 202: connect failed: Connection refused ERROR:
JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports
initialized [debugInit.c:750]
If I set it to off in the damain.cml, I still get the error and am unable to start the server.
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" debug-enabled="true" system-classpath="">
In glassfish\domains\domain1\config\domain.xml :
<java-config classpath-suffix="" debug-options="-agentlib:jdwp=transport=dt_socket,address=9009,server=y,suspend=n" java-home="C:\Program Files\Java\jdk1.8.0_162" debug-enabled="true" system-classpath="">
or in http://localhost:4848/common/index.jsf
2. In current Idea - Server Run Configuration - Debug - Port - address
I had the same problem and this solution also did the trick for me: Provide the IP 127.0.0.1 in the Intellij Debug configuration instead of the host name "localhost", in case you're using this hostname.
I have simple solution on that but its not permanent fix on this issue. You can invalidate and restart your IntelliJ Idea and try again to debug your codebase.

Problems with heroku remote debugging in IntelliJ

I started the command "heroku ps:forward 9090 --app [app-name]". I added a "Remote" debug configuration in IntelliJ, and set host to "localhost" and port to "9090". I start the debugger, and after a while I get this message:
"Error running '[configuration name]': Unable to open debugger port (localhost:9090): java.io.IOException "handshake failed - connection prematurely closed".
I checked with netstat that port 9090 is actually listening for a connection.
So it turns out that in order to enable debugging with heroku, you need a "Procfile". It is possible to run an instance without this file, but then the default parameters are used (and that's obviously what we were doing).
After adding this "Procfile", debugging finally works:
web: java -Dserver.port=$PORT $JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,address=9090,suspend=n -jar target/<.jar file>

Remote Debug for Cloud Foundry application fails when connecting eclipse remote debugger to forwarded local port

I'm trying to remotely debug a Spring boot application deployed on a cloud foundry Instance. Below are the steps that I'm following to setup remote debug using eclipse:
Setting up JBP_CONFIG_DEBUG: '{enabled: true}' environment variable for the application.
After that I'm setting up the local port forwarding to my app container with cf ssh -N -T -L 8000:localhost:8000 <APP_NAME>
Then I'm setting up the remote debug configuration in eclipse as shown below image:Eclipse remote debug setup
After that when I try to start remote debug session, It tried to connect to the app but fails with the message at the port forwarded terminal:
connect to localhost:8000 failed: ssh: rejected: connect failed (dial
tcp 127.0.0.1:8000: getsockopt: connection refused)
Please help, if anyone has any clue about this error!!
You might have to restage the application for the change to take place, debug configuration to change.
You can use alternatively ssh into the container using cf ssh <application name> and check that the debug port is opened on not using netstat -an
We had some issues as well, but with a specific java buildback, but anyway mabe it'll help you in your case as well, try:
cf set-env <app-name> JBP_CONFIG_JAVA_OPTS '[java_opts: "-XX:+ForceDebuggingOnDemand"]'
cf restage <app-name>
try to change debugging port like this:
JBP_CONFIG_DEBUG "{enabled: true, port: 8001}"

IDEA failed to start a local glassfish server

I'm trying to start Glassfish 4.1 in Intellij IDEA 13.1.4. I've set basic settings in Run/debug configurations window - selected application server, jvm, put 2 artifacts to deploy, left startup/connection configurations default. When I try to start it the exception is thrown. Here is full stack trace:
/home/glassfish/glassfish/bin/asadmin start-domain domain1
Detected server admin port: 4848
Detected server http port: 8080
[2014-11-14 03:09:49,839] Artifact ss-ear:ear: Server is no connected.Deploy is not available.
[2014-11-14 03:09:49,839] Artifact ss-ear:ear exploded: Server is not connected. Deploy is not available.
java.nio.file.AccessDeniedException: /home/glassfish/glassfish/domains/domain1/logs/server.log.lck
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177)
at java.nio.channels.FileChannel.open(FileChannel.java:287)
at java.nio.channels.FileChannel.open(FileChannel.java:335)
at java.util.logging.FileHandler.openFiles(FileHandler.java:438)
at java.util.logging.FileHandler.<init>(FileHandler.java:318)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:99)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:192)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:228)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:124)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:322)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:366)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:300)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Command start-domain failed.
Before it died, it produced the following output:
Listening for transport dt_socket at address: 9009
Launching GlassFish on Felix platform
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:246)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:349)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
I'm using Ubuntu OS 14.04 LTS, java-1.7.0-openjdk-amd64.
Glassfish installed in /home/glassfish, asadmin script have 777 permissions.
Server starts when i run it from terminal, but not from IDE.
Please help, it makes me mad!
See this "java.nio.file.AccessDeniedException" it says all. Give permissions to the gassfish folder.
sudo chmod -R 777 /wherever-the-folder-is/glassfish-folder
Have you tried to start IntelliJ with sudo permission and start the server within the ide?
open CMD as Run as Administrator and then start the glassfish domain. so that the domain will start.

Categories

Resources