0

我在 tomacat 中执行我的 servlet 时遇到了这个错误......

代码...用于发送数据...

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 正在尝试将发布请求发送到 Dropbox 以获取 request_token 但在我的 servlet 执行期间我收到此类错误.. 通过控制台 main() 函数执行相同的代码时...我得到了正确的结果但同样不是来自小服务程序

4

1 回答 1

0

您正在请求令牌 PostMethod("https://api.dropbox.com/1/oauth/request_token");

还要传递一个令牌作为参数?

get.addParameter("oauth_token", "z3d00yk6qwh2eui");

于 2012-10-13T15:27:38.813 回答