Twilio Java API を使用して電話をかけようとしています。以下はコードです。
public static Result call() {
Logger.debug("calling the requested number");
Form<User> form = userForm.bindFromRequest();
User user = form.get();
Logger.debug("Information submitted " + user.toString());
/* Instantiate a new Twilio Rest Client */
TwilioRestClient client = new TwilioRestClient(ACCOUNTSID, AUTHTOKEN);
// Get the account and call factory class
Account acct = client.getAccount();
CallFactory callFactory = acct.getCallFactory();
//build map of post parameters
Map<String,String> params = new HashMap<String,String>();
url = url + user.getCalleeNumber();
Logger.debug("url is " + url);
params.put("From", "+18054094292");
params.put("To", user.getCallerNumber());
params.put("Url", url);
try {
// Make a phone call ( This makes a POST request to the Calls resource)
callFactory.create(params);
} catch (TwilioRestException e) {
e.printStackTrace();
}
return ok("");
}
そのため、コードは、play "run 8081" または play "start 8081" を使用して開発モードまたは製品モードで実行した場合に機能します。しかし、アプリケーションをステージングして nohup 経由で実行すると、以下のエラーが発生します。なぜこれが起こるのか推測します。スタックトレースは以下です。
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: method <init>()V not found]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:132) [play_2.10.jar:2.1.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:128) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
java.lang.RuntimeException: java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: method <init>()V not found
at play.libs.F$Promise$6.apply(F.java:401) ~[play_2.10.jar:2.1.0]
at scala.concurrent.Future$$anonfun$map$1.liftedTree2$1(Future.scala:253) ~[scala-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na]
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:249) ~[scala-library.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:29) ~[scala-library.jar:na]
at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.liftedTree1$1(BatchingExecutor.scala:67) ~[akka-actor_2.10.jar:na]
Caused by: java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager: method <init>()V not found
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:139) ~[twilio-java-sdk-3.3.14-jar-with-dependencies.jar:na]
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:110) ~[twilio-java-sdk-3.3.14-jar-with-dependencies.jar:na]
at controllers.Application.call(Application.java:42) ~[twilio-test-1_2.10-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$2$$anonfun$apply$2.apply(routes_routing.scala:69) ~[twilio-test-1_2.10-1.0-SNAPSHOT.jar:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$2$$anonfun$apply$2.apply(routes_routing.scala:69) ~[twilio-test-1_2.10-1.0-SNAPSHOT.jar:na]
at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:141) ~[play_2.10.jar:2.1.0]