使用播放框架检索 OpenTok Session 对象时出现异常

Exception while retriving OpenTok Session object in with play framework

我正在创建 Tokbox 中提到的会话 documetation 使用播放框架。我的代码如下..

OpenTok opentok = new OpenTok(ApiCredentials.apiKey, ApiCredentials.apiSecret);Session session = null;
    try {


        session = opentok.createSession();
    } catch (OpenTokException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

会话=opentok.createSession();此行给出以下异常

[ERROR] [07/13/2015 01:55:16.570] [application-akka.actor.default-dispatcher-10] [ActorSystem(application)] Uncaught fatal error from thread [application-akka.actor.default-dispatcher-10] shutting down ActorSystem [application]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:39)
at com.opentok.OpenTok.createSession(OpenTok.java:247)
at com.opentok.OpenTok.createSession(OpenTok.java:301)
at controllers.TokBoxController.createSession(TokBoxController.java:50)
at router.Routes$$anonfun$routes$$anonfun$applyOrElse$$anonfun$apply.apply(Routes.scala:768)
at router.Routes$$anonfun$routes$$anonfun$applyOrElse$$anonfun$apply.apply(Routes.scala:768)
at play.core.routing.HandlerInvokerFactory$$anon.resultCall(HandlerInvoker.scala:136)
at play.core.routing.HandlerInvokerFactory$JavaActionInvokerFactory$$anon$$anon$$anon.invocation(HandlerInvoker.scala:127)
at play.core.j.JavaAction$$anon.call(JavaAction.scala:65)
at play.http.DefaultHttpRequestHandler.call(DefaultHttpRequestHandler.java:20)
at play.core.j.JavaAction$$anonfun.apply(JavaAction.scala:85)
at play.core.j.JavaAction$$anonfun.apply(JavaAction.scala:85)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at play.core.j.HttpExecutionContext$$anon.run(HttpExecutionContext.scala:40)
at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:70)
at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32)
at scala.concurrent.impl.Future$.apply(Future.scala:31)
at scala.concurrent.Future$.apply(Future.scala:492)
at play.core.j.JavaAction.apply(JavaAction.scala:85)
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:105)
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply$$anonfun$apply.apply(Action.scala:105)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply.apply(Action.scala:104)
at play.api.mvc.Action$$anonfun$apply$$anonfun$apply.apply(Action.scala:103)
at scala.Option.map(Option.scala:146)
at play.api.mvc.Action$$anonfun$apply.apply(Action.scala:103)
at play.api.mvc.Action$$anonfun$apply.apply(Action.scala:96)
at play.api.libs.iteratee.Iteratee$$anonfun$mapM.apply(Iteratee.scala:524)
at play.api.libs.iteratee.Iteratee$$anonfun$mapM.apply(Iteratee.scala:524)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM.apply(Iteratee.scala:560)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM.apply(Iteratee.scala:560)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$$anonfun$apply.apply(Iteratee.scala:536)
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$$anonfun$apply.apply(Iteratee.scala:536)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

请帮助我..我从某一天开始就卡住了

Redirect("/yourRedirectPage").withSession("storeSession" -> opentok)

试试这个:-

OpenTok opentok = new OpenTok(OPEN_TOK_API_KEY,OPEN_TOK_API_SECRET);
Session session = opentok.createSession(new SessionProperties.Builder()
              .mediaMode(MediaMode.ROUTED)
              .build());

并重新检查您的 "API_KEY" 和 "API_SECRET_KEY"

我花了一点时间,而且这不是正确的解决方案.. 在集成 tok box api 时,我无法理解 play 库的确切问题,所以我使用了 open tok's rest api and integrate it in play application with play WS api。感谢您的帮助和支持。