Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.google.gson.JsonParseException: Type information is unavailable, and the target object is not a primitive #15

Open
linch526 opened this issue Jun 2, 2016 · 4 comments

Comments

@linch526
Copy link

linch526 commented Jun 2, 2016

demo直接运行Main方法,一直报错,如下,第一次集成这个支付,好无力,求大神解答,
警告: Overriding the existing type handler for interface java.util.Map
Exception in thread "main" com.google.gson.JsonParseException: Type information is unavailable, and the target object is not a primitive: {"orderInfo":"_input_charset="utf-8"&body="Your Body"&it_b_pay="2016-06-03 16:31:15"&notify_url="https%3A%2F%2Fapi.pingxx.com%2Fnotify%2Fcharges%2Fch_yHS0CC4qTerDmznHWLj5WHKC"&out_trade_no="1464856241617rbrm4vv"&partner="2008536698119845"&payment_type="1"&seller_id="2008536698119845"&service="mobile.securitypay.pay"&subject="Your Subject"&total_fee="1.00"&sign="UG1EdVBTTGF2TEdLNW1UaTUweWZmYnJQ"&sign_type="RSA""}
at com.google.gson.JsonObjectDeserializationVisitor.visitPrimitive(JsonObjectDeserializationVisitor.java:130)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:116)
at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54)
at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:68)
at com.google.gson.MapTypeAdapter.deserialize(MapTypeAdapter.java:33)
Disconnected from the target VM, address: '127.0.0.1:58520', transport: 'socket'
at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51)
at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92)
at com.google.gson.JsonObjectDeserializationVisitor.visitFieldUsingCustomHandler(JsonObjectDeserializationVisitor.java:117)
at com.google.gson.ReflectingFieldNavigator.visitFieldsReflectively(ReflectingFieldNavigator.java:63)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:120)
at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54)
at com.google.gson.Gson.fromJson(Gson.java:551)
at com.google.gson.Gson.fromJson(Gson.java:521)
at com.pingplusplus.net.ChargeDeserializer.deserialize(ChargeDeserializer.java:49)
at com.pingplusplus.net.ChargeDeserializer.deserialize(ChargeDeserializer.java:20)
at com.google.gson.JsonDeserializerExceptionWrapper.deserialize(JsonDeserializerExceptionWrapper.java:51)
at com.google.gson.JsonDeserializationVisitor.invokeCustomDeserializer(JsonDeserializationVisitor.java:92)
at com.google.gson.JsonDeserializationVisitor.visitUsingCustomHandler(JsonDeserializationVisitor.java:80)
at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:101)
at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76)
at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54)
at com.google.gson.Gson.fromJson(Gson.java:551)
at com.google.gson.Gson.fromJson(Gson.java:498)
at com.google.gson.Gson.fromJson(Gson.java:467)
at com.google.gson.Gson.fromJson(Gson.java:417)
at com.google.gson.Gson.fromJson(Gson.java:389)
at com.pingplusplus.net.APIResource.request(APIResource.java:543)
at com.pingplusplus.model.Charge.create(Charge.java:274)
at com.pingxx.example.ChargeExample.createCharge(ChargeExample.java:71)
at com.pingxx.example.ChargeExample.runDemos(ChargeExample.java:37)
at com.pingxx.example.Main.main(Main.java:48)

@Ftamsir
Copy link

Ftamsir commented Feb 18, 2017

pom文件里更新一下gson的版本就好了

@czzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

我也遇到了此问题,请问下怎么解决的啊

@Ftamsir
Copy link

Ftamsir commented Apr 18, 2019 via email

@czzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

好的,我刚才试着升级了版本,也成功了!非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants