0
我面對上執行我的tomacat的servlet這個錯誤....發送請求到Dropbox的
代碼...用於發送數據...
String result= URLEncoder.encode(oauth_token , "UTF-8")+"&";
PostMethod get = new PostMethod("https://api.dropbox.com/1/oauth/request_token");
get.addParameter("oauth_consumer_key", "fm5qq8panuw0rnm");
get.addParameter("oauth_nonce",String.valueOf(nonce));
get.addParameter("oauth_signature_method", "PLAINTEXT");
get.addParameter("oauth_signature", result);
get.addParameter("oauth_timestamp",String.valueOf(timestamp.getTime()/1000));
get.addParameter("oauth_token", "z3d00yk6qwh2eui");
int status= client.executeMethod(get);
/////// ////////////////////////
HTTP狀態500 -
type Exception report
message
description The server encountered an internal error() that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class Ser
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
java.lang.Class.getConstructor0(Class.java:2714)
java.lang.Class.newInstance0(Class.java:343)
java.lang.Class.newInstance(Class.java:325)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
root cause
java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpMethod
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
java.lang.Class.getConstructor0(Class.java:2714)
java.lang.Class.newInstance0(Class.java:343)
java.lang.Class.newInstance(Class.java:325)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.12 logs.
AI正試圖發送POST請求dropbox來獲得request_tok但在執行我的servlet時,我得到這樣的錯誤..通過consle main()函數執行相同的代碼...我得到正確的結果,但不是從servlet中得到相同的結果
該堆棧軌跡中的哪一行表示您發佈的源代碼中的一行? –
PostMethod ... – behinddwalls
我沒有看到任何你的代碼在堆棧跟蹤。我希望在某處看到堆棧跟蹤中的「executeMethod」。這個堆棧跟蹤看起來好像與上面提供的代碼無關。 –