回调uri没有在google api安装的应用程序中打开

时间:2013-08-21 15:32:37

标签: oauth google-oauth google-api-java-client

我正在使用oauth2使用google fusion tables java客户端在java中编写一个小型桌面应用程序。我可以让浏览器打开,以便用户可以登录他/她的谷歌帐户,但登录应用程序崩溃后给我这个例外:

Please open the following address in your browser:
  https://accounts.google.com/o/oauth2/auth?client_id=611708255166-npbqbne71spdn8fa1tfsegbl2msi8lsk.apps.googleusercontent.com&redirect_uri=http://localhost:63909/Callback&response_type=code&scope=https://www.googleapis.com/auth/fusiontables
Attempting to open that address in the default browser now...
2013-08-21 11:27:28.076:WARN::/Callback?code=4/V8EpwmnrtF48VjXerABWDPZNyllS.ov1iLPSii_IVshQV0ieZDAps5vxCgQI
java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.flushBuffer()V
    at com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver$CallbackHandler.handle(LocalServerReceiver.java:220)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

所以看起来回调uri不起作用。我不希望我的回调uri指向任何网站,因为这是一个桌面应用程序,但我想回到我的应用程序让用户知道对融合表的调用已经完成。

1 个答案:

答案 0 :(得分:1)

冒着明显的风险,错误是“java.lang.NoSuchMethodError:javax.servlet.http.HttpServletResponse.flushBuffer”

如果我在https://code.google.com/p/google-oauth-java-client/source/browse/google-oauth-client-jetty/src/main/java/com/google/api/client/extensions/jetty/auth/oauth2/LocalServerReceiver.java?r=2c0510b314d24701810aa277f5d803a4368b2e20

查看LocalServerReceiver.java:220课程

第220行是空白的。

所以我会仔细检查您的库版本。

另请检查您的类路径以查看找到javax.servlet.http.HttpServletResponse的位置。