作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个程序可以将新患者插入服务器内 docker 容器中的 HBase。一切正常,直到我尝试将连接 IP 更改为运行 JUnit 测试的 phoenix 查询服务器。我在这样的属性文件中设置 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 协议(protocol)进行连接。它应该是其中之一。
关于java - JsonParseException : Unexpected character ('<' (code 60)): expected a valid value (number, 字符串、数组、对象、 'true'、 'false' 或 'null'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37049956/
我是一名优秀的程序员,十分优秀!