java.lang.IllegalArgumentException: JsonSerializer net.dean.jraw.models.z has no default constructor or is abstract

GitHub | freundTech | 3 months ago
  1. 0

    GitHub comment 2106#244047933

    GitHub | 3 months ago | freundTech
    java.lang.IllegalArgumentException: JsonSerializer net.dean.jraw.models.z has no default constructor or is abstract
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    Jackson, Retrofit, JodaTime deserialization

    Stack Overflow | 7 months ago | guisantogui
    com.fasterxml.jackson.databind.JsonMappingException: Class com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer has no default (no arg) constructor at [Source: java.io.InputStreamReader@525b461a; line: 1, column: 1]
  4. 0

    I have a MessageConverter created like this: {code} ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.registerModule(new Jackson2HalModule()); mapper.registerModule(new JSR310Module()); MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converter.setSupportedMediaTypes(singletonList(MediaTypes.HAL_JSON)); converter.setObjectMapper(mapper); {code} When I use RestTemplate to send any subclasses of ResourceSupport, it does _not_ use this message converter, emitting this stacktrace as a warning: {code} 17:30:07.693 [main] WARN o.s.h.c.j.MappingJackson2HttpMessageConverter - Failed to evaluate serialization for type [class com.mz.antfarm.client.dtos.contactmethods.DtoUSAAddressMethod] com.fasterxml.jackson.databind.JsonMappingException: Class org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer has no default (no arg) constructor at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1125) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.SerializerProvider._findExplicitUntypedSerializer(SerializerProvider.java:1089) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.hasSerializerFor(DefaultSerializerProvider.java:392) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ObjectMapper.canSerialize(ObjectMapper.java:2412) ~[jackson-databind-2.5.4.jar:2.5.4] at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.canWrite(AbstractJackson2HttpMessageConverter.java:173) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.web.client.RestTemplate$HttpEntityRequestCallback.doWithRequest(RestTemplate.java:786) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:594) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:357) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE] at com.mz.antfarm.client.AntFarmClient.save(AntFarmClient.java:320) [classes/:na] at com.mz.antfarm.client.dtos.DtoHub.addContactMethods(DtoHub.java:75) [classes/:na] at com.mz.antfarm.client.HubIT.testHubContacts(HubIT.java:39) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_66] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_66] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) [spring-test-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12] at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) [junit-rt.jar:na] at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) [junit-rt.jar:na] Caused by: java.lang.IllegalArgumentException: Class org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer has no default (no arg) constructor at com.fasterxml.jackson.databind.util.ClassUtil.createInstance(ClassUtil.java:370) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializerInstance(DefaultSerializerProvider.java:532) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BasicSerializerFactory.findSerializerFromAnnotation(BasicSerializerFactory.java:492) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory._constructWriter(BeanSerializerFactory.java:718) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.findBeanProperties(BeanSerializerFactory.java:567) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.constructBeanSerializer(BeanSerializerFactory.java:351) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.findBeanSerializer(BeanSerializerFactory.java:270) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:223) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:152) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1166) ~[jackson-databind-2.5.4.jar:2.5.4] at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1120) ~[jackson-databind-2.5.4.jar:2.5.4] ... 38 common frames omitted {code} The corresponding deserializer (HalLinkListDeserializer) is getting used to read in objects on the server side, which means the client isn't sending the JSON that the server expects.

    Spring JIRA | 6 months ago | PJ Weisberg
    com.fasterxml.jackson.databind.JsonMappingException: Class org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer has no default (no arg) constructor

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      JsonSerializer net.dean.jraw.models.z has no default constructor or is abstract

      at net.dean.jraw.models.meta.ModelManager.getSerializer()
    2. net.dean.jraw
      Paginator.next
      1. net.dean.jraw.models.meta.ModelManager.getSerializer(ModelManager.java:63)
      2. net.dean.jraw.models.meta.ModelManager.parse(ModelManager.java:132)
      3. net.dean.jraw.models.meta.ModelManager.create(ModelManager.java:22)
      4. net.dean.jraw.models.Listing.initChildren(Listing.java:80)
      5. net.dean.jraw.models.Listing.<init>(Listing.java:36)
      6. net.dean.jraw.http.RestResponse.asListing(RestResponse.java:102)
      7. net.dean.jraw.paginators.Paginator.parseListing(Paginator.java:268)
      8. net.dean.jraw.paginators.Paginator.next(Paginator.java:120)
      9. net.dean.jraw.paginators.SubredditPaginator.next(SubredditPaginator.java:69)
      10. net.dean.jraw.paginators.Paginator.next(Paginator.java:70)
      10 frames
    3. me.ccrama.redditslide
      SubredditPosts$LoadData.doInBackground
      1. me.ccrama.redditslide.Adapters.SubredditPosts$LoadData.getNextFiltered(SubredditPosts.java:404)
      2. me.ccrama.redditslide.Adapters.SubredditPosts$LoadData.doInBackground(SubredditPosts.java:363)
      3. me.ccrama.redditslide.Adapters.SubredditPosts$LoadData.doInBackground(SubredditPosts.java:251)
      3 frames
    4. Android Platform
      AsyncTask$2.call
      1. android.os.AsyncTask$2.call(AsyncTask.java:295)
      1 frame
    5. Java RT
      FutureTask.run
      1. java.util.concurrent.FutureTask.run(FutureTask.java:237)
      1 frame
    6. Android Platform
      AsyncTask$SerialExecutor$1.run
      1. android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
      1 frame
    7. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      3. java.lang.Thread.run(Thread.java:818)
      3 frames