jdereg / json-io

Convert Java to JSON. Convert JSON to Java. Pretty print JSON. Java JSON serializer. Deep copy Java object graphs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not instantiate m.Store.jedison.JedisonMessageProductImageDownload using any constructor

momomo opened this issue · comments

{"@type":"m.Store.jedison.JedisonMessageProductImageDownload","id":30,"url":"https://cdnbigbuy.com/images/i-cigarette-fruit-mix-01_1.jpg","source":{"name":"bigbuy"},"version":1,"created":{"time":"1626717528000","nanos":"415817447"},"status":{"name":"CREATED"},"queued":[{"@type":"m.Jedison.JMessage$QueuedRecord","queued":{"time":"1626717528000","nanos":"415818547"},"processing":[]}]}

First the constructor was protected. Then I changed it to public. Still Error.

Could not instantiate m.Store.jedison.JedisonMessageProductImageDownload using any constructor

------------------------------------------------------------------------
com.cedarsoftware.util.io.JsonIoException
------------------------------------------------------------------------

com.cedarsoftware.util.io.MetaUtils.tryOtherConstruction(MetaUtils.java:665)
com.cedarsoftware.util.io.MetaUtils.newInstanceEx(MetaUtils.java:570)
com.cedarsoftware.util.io.MetaUtils.newInstance(MetaUtils.java:540)
com.cedarsoftware.util.io.JsonReader.newInstance(JsonReader.java:799)
com.cedarsoftware.util.io.Resolver.newInstance(Resolver.java:652)
com.cedarsoftware.util.io.Resolver.createJavaObjectInstance(Resolver.java:

Not sure what the issue is. But you guys should not care about protected or public or whatever. This object contains other things that are inner classes and what not and could be hidden. You should just ignore the visibility and do it anyway.

Google Gson had no issues with this but they also did not get me the types.

Moving on.

Use a custom instantiater to address this. See assignInstantiator, customization technique #2 in the user guide.