0

私は単純な選択カウントクエリを作成しようとしました:

お宝データガイド

    Properties props = new Properties();
    props.setProperty("user", "someUser");
    props.setProperty("password", "password1");

    // Alternatively, you can use API key instead of user and password
    // props.setProperty("apikey", "(your API key)")

    // For using SSL connection (default is false)
    props.setProperty("useSSL", "true");

    // To run Hive jobs specify "type" parameter. The default is "presto"
    props.setProperty("type", "presto");

    java.sql.Connection conn = DriverManager.getConnection("jdbc:presto://api.treasuredata.com/sample_datasets", props);
    Statement st = conn.createStatement();
    try {
        ResultSet rs = st.executeQuery("SELECT count(1) FROM www_access");
        while (rs.next()) {
            int count = rs.getInt(1);
            System.out.println("result = " + count);
        }
        rs.close();
    } finally {
        st.close();
        conn.close();
    }

どうすればこのエラーを解決できますか:

HTTP protocol violation: Authentication challenge without WWW-Authenticate header

完全なスタック トレースが添付されています。

    Exception in thread "main" java.sql.SQLException: Error executing query
    at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:232)
    at com.facebook.presto.jdbc.PrestoStatement.executeQuery(PrestoStatement.java:69)
    at com.Xxxxxxxx.DatabaseProvider.main(DatabaseProvider.java:393)
Caused by: java.lang.RuntimeException: Error reading response from server
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.readResponseBytes(FullJsonResponseHandler.java:75)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.handle(FullJsonResponseHandler.java:61)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.handle(FullJsonResponseHandler.java:35)
    at com.facebook.presto.jdbc.internal.airlift.http.client.jetty.JettyHttpClient.execute(JettyHttpClient.java:377)
    at com.facebook.presto.jdbc.internal.client.StatementClient.<init>(StatementClient.java:115)
    at com.facebook.presto.jdbc.QueryExecutor.startQuery(QueryExecutor.java:62)
    at com.facebook.presto.jdbc.PrestoConnection.startQuery(PrestoConnection.java:597)
    at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:207)
    ... 2 more
Caused by: java.io.IOException: com.facebook.presto.jdbc.internal.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
    at com.facebook.presto.jdbc.internal.jetty.client.util.InputStreamResponseListener$Input.toIOException(InputStreamResponseListener.java:353)
    at com.facebook.presto.jdbc.internal.jetty.client.util.InputStreamResponseListener$Input.read(InputStreamResponseListener.java:321)
    at com.facebook.presto.jdbc.internal.guava.io.CountingInputStream.read(CountingInputStream.java:62)
    at java.io.FilterInputStream.read(FilterInputStream.java:107)
    at com.facebook.presto.jdbc.internal.guava.io.ByteStreams.copy(ByteStreams.java:70)
    at com.facebook.presto.jdbc.internal.guava.io.ByteStreams.toByteArray(ByteStreams.java:115)
    at com.facebook.presto.jdbc.internal.airlift.http.client.FullJsonResponseHandler.readResponseBytes(FullJsonResponseHandler.java:72)
    ... 9 more
Caused by: com.facebook.presto.jdbc.internal.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
    at com.facebook.presto.jdbc.internal.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:114)
    at com.facebook.presto.jdbc.internal.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
    at com.facebook.presto.jdbc.internal.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
    at com.facebook.presto.jdbc.internal.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:457)
    at com.facebook.presto.jdbc.internal.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:404)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:269)
    at com.facebook.presto.jdbc.internal.jetty.http.HttpParser.parseContent(HttpParser.java:1515)
    at com.facebook.presto.jdbc.internal.jetty.http.HttpParser.parseNext(HttpParser.java:1332)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:159)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:120)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:70)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:90)
    at com.facebook.presto.jdbc.internal.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:115)
    at com.facebook.presto.jdbc.internal.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
    at com.facebook.presto.jdbc.internal.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at com.facebook.presto.jdbc.internal.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
    at com.facebook.presto.jdbc.internal.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
    at java.lang.Thread.run(Thread.java:745)
4

1 に答える 1

1

DATORAMA とその Presto コネクタを使用しているようです。ただし、TreasureData 上の Presto は一般的な Presto コネクタをサポートしていません。そのため、現在、DATORAMA から直接 TreasureData にクエリを発行することはできません。

ただし、Treasure Data のクエリは、FTP への結果出力を使用して、結果を Datorama にプッシュすることができます。

これらの書類を確認してください。

https://docs.treasuredata.com/articles/result-into-datorama https://docs.treasuredata.com/articles/result-into-ftp

于 2016-07-20T13:40:47.357 に答える