3
votes

I am working on maven and spring. I have created simple class having main method, to create the OpenTok SessionId but getting exception as follows

Exception in thread "main" java.lang.NoSuchMethodError: com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.setParameters(Lcom/ning/http/client/FluentStringsMap;)Lcom/ning/http/client/AsyncHttpClient$BoundRequestBuilder; at com.opentok.util.HttpClient.createSession(HttpClient.java:48) at com.opentok.OpenTok.createSession(OpenTok.java:252) at com.opentok.OpenTok.createSession(OpenTok.java:306) at webapp.test.com.OpenToks.main(OpenTokProg.java:28)

My code is inside main method

  OpenTok opentok = new OpenTok(API_KEY,API_SECRET);
  String sessionId = opentok.createSession().getSessionId();

I having tried following steps -- got from "forums.tokbox.com/supported-server-api/exception-while-getting-session-object-in-java-t46638#p60778"

1) Make sure that you successfully build path for java server sdk. --> used in pom.xml

         <dependency>
            <groupId>com.tokbox</groupId>
            <artifactId>opentok-server-sdk</artifactId>
            <version>2.3.2</version>
        </dependency>

2) Try using hard coded API key and secret key (for testing purpose)at the time you making object of Opentok. --> tried again same error

3) Make sure you have an access to Opentok server, run a diagnose over this link. http://tokbox.com/tools/connectivity/ --> getting Message: Successful for all connections

Please help

1

1 Answers

0
votes

The version of AsyncHttpClient that was used for compiling com.opentok.util.HttpClient (probably 1.8) is different from the one that's provided at runtime (probably 1.9).

Between those versions, the setParameters method was renamed into setFormParameters.

You have to find out where this clash comes from and resolve it. Use mvn dependency:tree to figure out which library depends on which.