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

2022-09-04 04:40:38

我有一个程序,可以将新患者插入服务器内部的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] 

我不确定为什么我收到解析异常。由于外部 API,调试没有帮助。我甚至不知道异常是否与我的属性文件中的URL格式有关,是否与患者(以xml格式提供)有关,甚至可能与phoenix客户端有关。json

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

我在我的pom中添加了凤凰.xml像这样:

<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

答案 1

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


答案 2

检查是否正确提供了授权、标头和其他参数。

我通过检查这些步骤解决了。