Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 11-27-2016 02:30 PM
Hi,
I could not connect to Phoenix Query Server in HDP2.5 in my Java program using the thin JDBC client. Any advice?
My connection string is: jdbc:phoenix:thin:url=http://localhost:8765. I am using the thin driver: org.apache.phoenix.queryserver.client.Driver.
try {
Class.forName(driver);
conn = DriverManager.getConnection(connectionString);
} catch(Exception e) {
logger.error("Failed connecting to database.", e);
}I got the below error:
java.lang.RuntimeException: org.apache.phoenix.shaded.com.fasterxml.jackson.core.JsonParseException: Unexpected character ('o' (code 111)): Expected space separating root-level values
at [Source:
8org.apache.calcite.avatica.proto.Responses$ErrorResponse�
�org.apache.calcite.avatica.com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length.
at org.apache.calcite.avatica.com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(InvalidProtocolBufferException.java:70)
at org.apache.calcite.avatica.com.google.protobuf.CodedInputStream.skipRawBytesSlowPath(CodedInputStream.java:1293)
at org.apache.calcite.avatica.com.google.protobuf.CodedInputStream.skipRawBytes(CodedInputStream.java:1276)
at org.apache.calcite.avatica.com.google.protobuf.CodedInputStream.skipField(CodedInputStream.java:197)
at org.apache.calcite.avatica.com.google.protobuf.CodedInputStream.skipMessage(CodedInputStream.java:273)
at org.apache.calcite.avatica.com.google.protobuf.CodedInputStream.skipField(CodedInputStream.java:200)
at org.apache.calcite.avatica.proto.Common$WireMessage.<init>(Common.java:11627)
at org.apache.calcite.avatica.proto.Common$WireMessage.<init>(Common.java:11595)
at org.apache.calcite.avatica.proto.Common$WireMessage$1.parsePartialFrom(Common.java:12061)
at org.apache.calcite.avatica.proto.Common$WireMessage$1.parsePartialFrom(Common.java:12055)
at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:89)
at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:95)
at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
at org.apache.calcite.avatica.proto.Common$WireMessage.parseFrom(Common.java:11791)
at org.apache.calcite.avatica.remote.ProtobufTranslationImpl.parseRequest(ProtobufTranslationImpl.java:354)
at org.apache.calcite.avatica.remote.ProtobufHandler.decode(ProtobufHandler.java:51)
at org.apache.calcite.avatica.remote.ProtobufHandler.decode(ProtobufHandler.java:31)
at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:94)
at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:46)
at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:124)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.apache.phoenix.shaded.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.apache.phoenix.shaded.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.apache.phoenix.shaded.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Created 11-28-2016 08:08 AM
can you check that both phoenix query server and phoenix client versions are same.
Created 11-28-2016 08:08 AM
can you check that both phoenix query server and phoenix client versions are same.
Created 11-28-2016 02:36 PM
Both shipped from HDP2.5, should be the same.
Created 11-28-2016 02:47 PM
can you try adding serialization=PROTOBUF in your connection string. There seems to be property "phoenix.queryserver.serialization mismatch at client and server.
jdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF
Created 11-28-2016 02:49 PM
Yup! This is it. The client is trying to use JSON but the server is configured to use PROTOBUF.
If you want to use JSON (which I do not recommend), set phoenix.queryserver.serialization=JSON in hbase-site.xml and restart the Phoenix Query Server.
Created 11-29-2016 02:59 PM
Thanks, @Ankit Singhal
This solved the issue.
Created 12-01-2016 07:12 AM
it's great that it works for you..so can you accept the answer now so that it will be helpful for other users.