License Type | SaaS & On-Premise |
Agent Mode | Assess & Protect |
Main Product Category | Java Agent |
Sub Category | Connectivity |
Issue
The Contrast Java Agent fails to connect to the Contrast Server and the following cause is seen in the agent log:
java.net.ConnectException: Connection refused (Connection refused)
Cause
The most likely cause of this error is that a firewall rule is blocking connectivity to the Contrast UI Server. However another possibility is that in a containerized environment, when the JVM (and therefore the Java Agent) starts up, the networking components of the environment are not yet fully provisioned when the agent attempts to connect to the Contrast Server.
Resolution
Verify that a firewall rule is not in place blocking outbound traffic by attempting to reach the server from within the machine or container, for example using curl
:
curl -vL https://app.contrastsecurity.com/Contrast
or openssl
:
openssl s_client -connect app.contrastsecurity.com:443 -debug
If connectivity succeeds, and this is a containerized environment, you can delay the Java Agent's attempt to establish communication with the Contrast Server by adding a delay. The following two JVM options will achieve that result:
-Dcontrast.agent.startup_delay_ms=30000
-Dcontrast.agent.java.delayed_startup_strategy=boot
See also: