cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

com.mks.api.response.APIConnectionException: Remote host closed connection during handshake

Highlighted
Newbie

com.mks.api.response.APIConnectionException: Remote host closed connection during handshake

Hi,

I keep getting this error when running my code:

com.mks.api.response.APIConnectionException: Remote host closed connection during handshake

import com.mks.api.CmdRunner;
import com.mks.api.Command;
import com.mks.api.IntegrationPoint;
import com.mks.api.IntegrationPointFactory;
import com.mks.api.Option;
import com.mks.api.Session;
import com.mks.api.response.APIException;
import com.mks.api.response.Response;






public class MksMain {


@SuppressWarnings("deprecation")
public static void main(String[] args) {
String host = "";
int port = 7001;
boolean secure = true;
String user = "";
String password = "";

try {
IntegrationPoint ipf = IntegrationPointFactory.getInstance().createIntegrationPoint(host, port, secure, 4, 11);
Session session = ipf.createSession(user, password);
CmdRunner cmd = session.createCmdRunner();

cmd.setDefaultHostname(host);
cmd.setDefaultPort(port);
cmd.setDefaultHostname(user);
cmd.setDefaultPassword(password);

Command connect = new Command(Command.SI, "connect");
connect.addOption(new Option("",""));

Command checkout = new Command(Command.SI, "co");
checkout.addOption(new Option("", ""));

Command disconnect = new Command(Command.SI, "disconnect");
connect.addOption(new Option("",""));


cmd.execute(checkout);


Response response = cmd.execute(checkout);
String resID = response.getResult().getMessage();
System.out.println("Established connection " + resID);
}
catch (APIException e){
System.out.println("oops");
e.printStackTrace();
}


}
}

Happens after line cmd.execute(checkout);

Any ideas?

Thanks in advance!

Tags (1)
1 REPLY 1

Re: com.mks.api.response.APIConnectionException: Remote host closed connection during handshake

Hello Andrei,

In this sort of situation, I would normally recommend contacting PTC Integrity Support to examine this issue, but I see that your account is not associated with a maintenance contract.

Could you supply some logging from the <ServerHome>/log/server.log file?

Are you using additional jar files? If so, are you sure you have the correct classpath to access those jar files?

Regards,

Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager