# java.io.IOException: Une connexion existante a d¹ Ûtre fermÚe par lÆh¶te distant

**URL:** <https://discuss.elastic.co/t/java-io-ioexception-une-connexion-existante-a-d-utre-fermue-par-laeh-te-distant/247786>\
**Category:** Elasticsearch\
**Created:** [September 7, 2020, 3:50pm UTC](https://discuss.elastic.co/t/java-io-ioexception-une-connexion-existante-a-d-utre-fermue-par-laeh-te-distant/247786 "2020-09-07T15:50:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torjmen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/torjmen/32/75223_2.png) [@Torjmen](https://discuss.elastic.co/u/Torjmen)\
**Post date:** [September 7, 2020, 3:50pm UTC](https://discuss.elastic.co/t/java-io-ioexception-une-connexion-existante-a-d-utre-fermue-par-laeh-te-distant/247786/1 "2020-09-07T15:50:13Z")

</div>

hello , i'm trying to create a plugin for openEdge form SonarQube API ,  
its' work well .  
I have programmes written in progress 4gl , for that i had created an AppServer using the Openedge explorer to put my programmes.p (progress 4gl ) in it .  
i have a code to run programmes in progress openEdge using java

```
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.progress.open4gl.ConnectException;
import com.progress.open4gl.Open4GLException;
import com.progress.open4gl.javaproxy.OpenAppObject;
import com.progress.open4gl.javaproxy.OpenProcObject;

/**
 * La class OpenEdgeAPSConnector.
 *
 * @author Torjmen
 */
@Component
@Scope("singleton")
public class OpenEdgeAPSConnector {

    /** La constante LOGGER. */
    private static final Logger LOGGER = LoggerFactory.getLogger(OpenEdgeAPSConnector.class);

    /** La constante CLOSE_CONNECTION_ERROR_MSG. */
    private static final String CLOSE_CONNECTION_ERROR_MSG = "Erreur lors de la cloture de la connexion AppServer";

    /** L'attribut message service. */
    @Autowired

    /** L'attribut app server connect max retries. */
    @Value("${AppServerConnectMaxRetries}")
    private String appServerConnectMaxRetries;

    /** L'attribut app server connect idle retry. */
    @Value("${AppServerConnectIdleRetry}")
    private String appServerConnectIdleRetry;

    /** L'attribut aps connect max retry. */
    private static int APS_CONNECT_MAX_RETRY = 5;

    /** L'attribut aps connect idle retry. */
    private static int APS_CONNECT_IDLE_RETRY = 1;

    /**
     * Init.
     */
    @PostConstruct
    private void init() {
        try {
            APS_CONNECT_MAX_RETRY = Integer.parseInt(appServerConnectMaxRetries);
            APS_CONNECT_IDLE_RETRY = Integer.parseInt(appServerConnectIdleRetry);
        } catch (Exception e) {
            if (LOGGER.isErrorEnabled()) {
                LOGGER.error("Impossible d'initialiser le connector APS", e);
            }

        }
    }

    /**
     * OAO factory.
     *
     * @param apsUrl
     * un aps url
     * @return le open app object
     * @throws IOException
     * Signals that an I/O exception has occurred.
     * @throws InterruptedException
     * une exception interrupted exception
     * @throws Open4GLException
     * une exception open 4 GL exception
     */
    private static OpenAppObject OAOFactory(String apsUrl) throws IOException, InterruptedException, Open4GLException {
        int i = APS_CONNECT_MAX_RETRY;
        boolean isRetryAgain = true;
        OpenAppObject oao = null;
        while (isRetryAgain) {
            try {
                oao = new OpenAppObject(apsUrl, "", "", "", "");
                isRetryAgain = false;
            } catch (ConnectException e) {
                if (i == 0) {
                    isRetryAgain = false;
                    throw e;
                }
                isRetryAgain = true;
                i--;
                TimeUnit.SECONDS.sleep(APS_CONNECT_IDLE_RETRY);
            }
        }
        return oao;
    }

    /**
     * Retourne l'attribut open app object instance.
     *
     * @param apsUrl
     * un aps url
     * @return l'attribut open app object instance
     * @throws NlwFunctionalException
     * une exception nlw functional exception
     * @throws IOException
     * Signals that an I/O exception has occurred.
     * @throws InterruptedException
     * une exception interrupted exception
     * @throws Open4GLException
     * une exception open 4 GL exception
     */
    public static OpenAppObject getOpenAppObjectInstance(String apsUrl) throws IOException, InterruptedException, Open4GLException {
        if ("".equalsIgnoreCase(apsUrl)) {
        }
        return OAOFactory(apsUrl);
    }

    /**
     * Progress clean up.
     *
     * @param oao
     * un oao
     */
    public static void progressCleanUp(OpenAppObject oao) {
        progressCleanUp(oao, null);
    }

    /**
     * Progress clean up.
     *
     * @param oao
     * un oao
     * @param opo
     * un opo
     */
    public static void progressCleanUp(OpenAppObject oao, OpenProcObject opo) {
        try {
            if (opo != null) {
                opo._cancelAllRequests();
                opo._release();
            }
        } catch (Open4GLException e) {
            oaoCleanup(oao);
        } finally {
            oaoCleanup(oao);
        }
    }

    /**
     * Oao cleanup.
     *
     * @param oao
     * un oao
     */
    private static void oaoCleanup(OpenAppObject oao) {
        if (oao != null) {
            try {
                oao._cancelAllRequests();
                oao._release();
            } catch (Open4GLException e) {
                if (LOGGER.isErrorEnabled()) {
                    LOGGER.error(CLOSE_CONNECTION_ERROR_MSG, e);
                }
            }
        }
    }

}

```

the problem is wan i strated the sonar server i get this msg

**java.io.IOException: Une connexion existante a d¹ Ûtre fermÚe par lÆh¶te distant**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 5, 2020, 3:50pm UTC](https://discuss.elastic.co/t/java-io-ioexception-une-connexion-existante-a-d-utre-fermue-par-laeh-te-distant/247786/2 "2020-10-05T15:50:19Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
