UnsupportedOperationException: JsonNull - OpenVidu Pro

We are using OpenVidu Pro 2.15.0 and using Java API for conferencing. We have received following exception.

java.lang.UnsupportedOperationException: JsonNull
at deployment.ECSIpvEAPv2.ear//com.google.gson.JsonElement.getAsString(JsonElement.java:179)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.lambda$resetSessionWithJson$3(Session.java:556)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.resetSessionWithJson(Session.java:531)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.(Session.java:69)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.lambda$null$2(OpenVidu.java:568)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.lambda$fetch$3(OpenVidu.java:565)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.fetch(OpenVidu.java:553)
at deployment.ECSIpvEAPv2.ear.ECSIpvServerV2.war//com.ecs.ipv.servlet.IPVService.processECSStopIPVRequest(IPVService.java:2075)

What could be be the reason for this Exception ?

We are still getting this issue and our production environment is severely affected. Can someone help please?

This is how we are calling the api and the fetch() is throwing exceptions. This is a production environment running OpenVidu Pro 2.15.0. Please help.

// Initialize OpenVidu
OpenVidu openvidu = new OpenVidu(openViduUrl, confSecret);
try {
openvidu.fetch();
} catch (OpenViduJavaClientException e1) {
e1.printStackTrace();
} catch (OpenViduHttpException e1) {
e1.printStackTrace();
}

Hi,

Have you followed the docs https://docs.openvidu.io/en/2.15.0/reference-docs/openvidu-java-client/ ?

Could you test pointing to our dev environment and check if the same behaviour is happening?

URL: https://demos.openvidu.io
SECRET: MY_SECRET

Hi,

It is not always happening in production, it happens intermittently. We are not able to reproduce in our UAT environment.

From your side can you check & tell why exception JsonNull is happening?

Please share with us the returned JSON when performing a GET request to the endpoint https://docs.openvidu.io/en/2.15.0/reference-docs/REST-API/#get-apisessions

Hi all,
the session.fetch() method also returns this exception: UnsupportedOperationException: JsonNull sometimes, i call it before session.getActiveConnections() method.

Please share with us the returned JSON when performing a GET request to the endpoint https://docs.openvidu.io/en/2.15.0/reference-docs/REST-API/#get-apisessions

In that way we can know what are the null entries to fix the issue.

Regards

Hi Micael,

I have masked the IP address and Turn credentials.

The session results in the file was taken later

Thanks
Prabu R

I think this bug is fixed in master branch https://github.com/OpenVidu/openvidu/commit/eedf393f6a4a0696aabf5498e5af17652857ebfb and it will be released in version 2.17.0.

Maybe as a workaround, try to use the API Rest in the meantime to not have this null pointer exception

We are using Java api in our application to creating conference sessions. Please let us know which REST API to use

We have also noticed, the JsonNull occurs in Session.java line 550

In client code in line 550 i can see the following code

subscribers.add((subscriber.getAsJsonObject()).get(“streamId”).getAsString());

Is there any way to fix this issue in java client library code?

java.lang.UnsupportedOperationException: JsonNull
at deployment.ECSIpvEAPv2.ear//com.google.gson.JsonElement.getAsString(JsonElement.java:179)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.lambda$null$2(Session.java:550)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.lambda$resetSessionWithJson$3(Session.java:549)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.resetSessionWithJson(Session.java:531)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.Session.(Session.java:69)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.lambda$null$2(OpenVidu.java:568)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.lambda$fetch$3(OpenVidu.java:565)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at deployment.ECSIpvEAPv2.ear//io.openvidu.java.client.OpenVidu.fetch(OpenVidu.java:553)

Than ks
Prabu R