Dusan
New Creator

Connection error with FirstSpirit Access API

Greetings everybody, I'm having issue connecting to the FirstSpirit server using the FirstSpirit Access API, namely I cannot seem to connect to one project because I keep getting the 504 status code back from the server more precisely this is the error:

Connecting to: "here was url of the server" on port: 443 as m.civcic
ERROR Mon May 22 12:58:08 CEST 2023 (de.espirit.firstspirit.client.nio.impl.FSHttpClientImpl) No response from server socket - HTTP/1.1 504 
ERROR Mon May 22 12:58:08 CEST 2023 (de.espirit.firstspirit.client.nio.impl.FSHttpClientImpl) FSHttpClient error - java.io.IOException: Unexpected HTTP state: (504) , Date=Mon, 22 May 2023 10:58:07 GMT / Server=Apache / Strict-Transport-Security=max-age=31536000 / X-Frame-Options=sameorigin / X-Content-Type-Options=nosniff / X-XSS-Protection=1; mode=block / Content-Type=text/html;charset=utf-8 / Content-Language=en / Content-Length=769 / Keep-Alive=timeout=5, max=94 / Connection=Keep-Alive - https://hereWasUrlToProject
<!doctype html><html lang="en"><head><title>HTTP Status 504 – Gateway Timeout</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 504 – Gateway Timeout</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Server socket closed!</p><p><b>Description</b> The server, while acting as a gateway or proxy, did not receive a timely response from an upstream server it needed to access in order to complete the request.</p><hr class="line" /><h3>Apache Tomcat/9.0.x</h3></body></html>
 
This is my class for connecting to a project:
 
 

 

public class Launcher {

    public static void main(String[] args) {
        connect();
    }

    /**
     * Method that connects to the First Spirit project
     */
    public static void connect() {
        final Connection connection = ConnectionManager.getConnection(HOST, PORT, MODE, USERNAME, PASS);
        ConnectionManager.setUseHttps(true);

        try {
            System.out.println("Connecting to: " + HOST + " on port: " + PORT + " as " + USERNAME);
            connection.connect();
            System.out.println("Connected.");

            SpecialistsBroker broker = connection.getBroker();
            final BrokerAgent brokerAgent = broker.requestSpecialist(BrokerAgent.TYPE);
            assert brokerAgent != null;
            broker = brokerAgent.getBrokerByProjectName(PROJECT_NAME);

        } catch (IOException | MaximumNumberOfSessionsExceededException e) {
            System.out.println("Connection failed.");
            e.printStackTrace();
        } catch (AuthenticationException e) {
            System.out.println("Wrong username or password! Please check your credentials and start the application again.");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                connection.close();
                System.out.println("Connection closed.");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

 

0 Kudos
0 Replies