我有一个程序,可以将新患者插入服务器内 docker 容器中的 HBase。一切工作正常,直到我尝试将连接 IP 更改为 phoenix 查询服务器以运行 JUnit 测试。我在属性文件中设置 URL,如下所示:
java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@1105b1f; line: 1, column: 2]
...
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.StringReader@1105b1f; line: 1, column: 2]
我不确定为什么会收到
json
解析异常。由于外部 api,调试没有帮助。我什至不知道异常是否与我的属性文件中的 URL 格式、患者(以 xml 格式)或什至与 phoenix 客户端有关。
我已经启动了phoenix查询服务器,看起来它可以连接到它,因为它之前抛出了“连接被拒绝”异常,但现在却没有。
我在我的pom.xml中添加了phoenix,如下所示:
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-server</artifactId>
<version>4.7.0-HBase-1.1</version>
</dependency>
但我不知道是否需要为 phoenix-thin-client 添加其他内容。如果必须的话,我找不到该依赖项,所以我只是假设它已包含在内。
如有任何帮助,我们将不胜感激!
编辑:
这是服务器抛出的异常:
> > 2016-05-05 08:52:11,979 WARN org.eclipse.jetty.server.HttpChannel: / java.lang.RuntimeException:
> 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.remote.AbstractHandler.apply(AbstractHandler.java:98)
> at org.apache.calcite.avatica.remote.ProtobufHandler.apply(ProtobufHandler.java:38)
> at org.apache.calcite.avatica.server.AvaticaProtobufHandler.handle(AvaticaProtobufHandler.java:68)
> at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
> at org.eclipse.jetty.server.Server.handle(Server.java:497)
> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
> at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
> at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
> at java.lang.Thread.run(Thread.java:745) Caused by: 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.parsePartialFrom(AbstractParser.java:137)
> at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:168)
> at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:180)
> at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:185)
> at org.apache.calcite.avatica.com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
> at org.apache.calcite.avatica.proto.Common$WireMessage.parseFrom(Common.java:11760)
> at org.apache.calcite.avatica.remote.ProtobufTranslationImpl.parseRequest(ProtobufTranslationImpl.java:236)
> at org.apache.calcite.avatica.remote.ProtobufHandler.decode(ProtobufHandler.java:42)
> at org.apache.calcite.avatica.remote.ProtobufHandler.decode(ProtobufHandler.java:28)
> at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:95)
> ... 11 more
您的Phoenix服务器是否正确升级?看起来它尝试使用 JSON 和 Protocol Buffer 协议进行连接。应该是其中之一。
检查您是否正确提供了授权、标头和其他参数。
我通过检查这些步骤解决了。
您能详细解释一下您为解决问题所采取的步骤吗?