JsonParseException:意外字符('<'(代码60)):预期有效值(数字,字符串,数组,对象,'true','false'或'null')

时间:2016-05-05 11:55:31

标签: java maven exception junit phoenix

我有一个程序,可以在服务器内的docker容器中将新患者插入HBase。一切正常,直到我尝试将连接IP更改为凤凰查询服务器以运行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解析异常。由于外部apis,调试没有帮助。我甚至不知道异常是否与我的属性文件中的URL格式,患者(以xml格式提供)或甚至与凤凰客户端相关。

我已经启动了凤凰查询服务器,看起来它可以连接到它,因为它之前抛出了“连接被拒绝”异常,现在却没有。

我在我的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

2 个答案:

答案 0 :(得分:2)

您是否正确升级了Phoenix服务器?看起来它试图使用JSON和协议缓冲区协议进行连接。它应该是一个或另一个。

答案 1 :(得分:0)

检查您是否正确提供了授权,标题和其他参数。

我通过以下步骤解决了