Connection Reset error with KalturaMediaService.add() and KalturaMediaServiceMedia.update

I am new to the Kaltura API. I have the following java program to create an entry:

import com.kaltura.client.enums.;
import com.kaltura.client.types.
;
import com.kaltura.client.services.*;
import com.kaltura.client.KalturaApiException;
import com.kaltura.client.KalturaClient;
import com.kaltura.client.KalturaConfiguration;
public class Upload{
public static void main(String[] args) {
try {
try{
KalturaConfiguration config = new KalturaConfiguration();
config.setEndpoint(“https://www.kaltura.com/”);
KalturaClient client = new KalturaClient(config);
String secret = “SECRET”;
String userId = “USER_ID”;
KalturaSessionType type = KalturaSessionType.ADMIN;
int partnerId = 99999999;
int expiry = 86400;
KalturaSessionService sessionService = client.getSessionService();
String ks = client.generateSessionV2(secret, userId, type, partnerId, expiry);
client.setKs(ks);
System.out.println(ks);
KalturaMediaEntry mediaEntry = new KalturaMediaEntry();
mediaEntry.name = “Entry 1”;
mediaEntry.mediaType = KalturaMediaType.VIDEO;
KalturaMediaService serv = new KalturaMediaService(client);
mediaEntry = serv.add(mediaEntry);
} catch (KalturaApiException e) {
e.printStackTrace();
}
} catch (Exception exc) {
exc.printStackTrace();

}
}

}

However I am getting these errors:

[18 Aug 2021 07:08:49] INFO - “I/O exception (java.net.SocketException) caught when processing request: Connection reset” - (HttpMethodDirector.java:439)
[18 Aug 2021 07:08:50] INFO - “Retrying request” - (HttpMethodDirector.java:445)
[18 Aug 2021 07:08:50] INFO - “I/O exception (java.net.SocketException) caught when processing request: Connection reset” - (HttpMethodDirector.java:439)
[18 Aug 2021 07:08:50] INFO - “Retrying request” - (HttpMethodDirector.java:445)
[18 Aug 2021 07:08:50] INFO - “I/O exception (java.net.SocketException) caught when processing request: Connection reset” - (HttpMethodDirector.java:439)
[18 Aug 2021 07:08:50] INFO - “Retrying request” - (HttpMethodDirector.java:445)
com.kaltura.client.KalturaApiException: I/O exception occured while reading request response
at com.kaltura.client.KalturaClientBase.executeMethod(KalturaClientBase.java:382)
at com.kaltura.client.KalturaClientBase.doQueue(KalturaClientBase.java:274)
at com.kaltura.client.services.KalturaMediaService.add(KalturaMediaService.java:66)
at org.unmultimedia.kaltura.Upload_4.main(Upload.java:41)

These are the versions of the libraries used:

commons-codec-1.6.jar
commons-httpclient-3.1.jar
commons-logging-1.1.1.jar
httpclient-4.2.3.jar
json-20090211.jar
KalturaClient-3.3.1.jar
log4j-1.2.15.jar

Any ideas on what could be the issue?

Hi @Munyua ,

Are you able to reach the www.kaltura.com endpoint from outside your Java code?
On the same machine, does:

$ telnet www.kaltura.com 443
or:
curl -v -I https://www.kaltura.com

Work for example?

Hi Jess,

Yes, I am able to. Both telnet and curl are successful.

I am also able to create an entry using the postman client but the java code won’t work.

Maybe it’s to do with SSL cert issues? What happens when you try with:

config.setEndpoint(“http://www.kaltura.com/”);

?

That worked!! thanks so much for this.

You’re welcome, @Munyua. However, I’d check the SSL issue if I were you since, ideally, you do want sensitive data to be encrypted.

Cheers

Sure thing, I’ll definitely follow up.