Announcement Announcement Module
Collapse
No announcement yet.
Weird Jackson error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weird Jackson error

    I forked spring-social to work on an Instagram binding and I've come across an error that I can't, for the life of me, figure out. It can be observed when running the tests. I'm by no means a Java or Spring expert so I'm turning to you guys for help!

    The stack trace is below, and my fork exists here: https://github.com/mattupstate/spring-social

    Code:
    org.springframework.web.client.ResourceAccessException: I/O error: Can not construct instance of org.codehaus.jackson.map.type.SimpleType, problem: abstract types can only be instantiated with additional type information at [Source: java.io.ByteArrayInputStream@213a8eb1; line: 1, column: 1]; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not construct instance of org.codehaus.jackson.map.type.SimpleType, problem: abstract types can only be instantiated with additional type information at [Source: java.io.ByteArrayInputStream@213a8eb1; line: 1, column: 1]
    
    org.springframework.web.client.ResourceAccessException: I/O error: Can not construct instance of org.codehaus.jackson.map.type.SimpleType, problem: abstract types can only be instantiated with additional type information
    at [Source: java.io.ByteArrayInputStream@213a8eb1; line: 1, column: 1]; nested exception is org.codehaus.jackson.map.JsonMappingException: Can not construct instance of org.codehaus.jackson.map.type.SimpleType, problem: abstract types can only be instantiated with additional type information
    at [Source: java.io.ByteArrayInputStream@213a8eb1; line: 1, column: 1]
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:415)
    at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:294)
    at org.springframework.social.instagram.UserTemplate.modifyRelationship(UserTemplate.java:107)
    at org.springframework.social.instagram.UserTemplate.followUser(UserTemplate.java:77)
    at org.springframework.social.instagram.UserTemplateTest.followUser(UserTemplateTest.java:108)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)
    at $Proxy4.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:86)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:48)
    at org.gradle.messaging.dispatch.DiscardOnFailureDispatch.dispatch(DiscardOnFailureDispatch.java:31)
    at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:129)
    at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
    at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:69)
    at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:637)
    Caused by: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of org.codehaus.jackson.map.type.SimpleType, problem: abstract types can only be instantiated with additional type information
    at [Source: java.io.ByteArrayInputStream@213a8eb1; line: 1, column: 1]
    at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)
    at org.codehaus.jackson.map.deser.StdDeserializationContext.instantiationException(StdDeserializationContext.java:210)
    at org.codehaus.jackson.map.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:97)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2131)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1455)
    at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:135)
    at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:154)
    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:74)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446)
    ... 52 more

  • #2
    Wow...that was a real puzzler, but I think I figured it out.

    It seems that you're importing com.sun.xml.internal.xsom.impl.scd.Iterators.Map in UserTemplate...you probably meant to import java.util.Map.

    But even then, if you don't care about the response in modifyRelationship(), then you don't even have to map the results to a Map...a String would suffice. And your test could set up the mock server to return "{}" (empty JSON) rather than media-list.json.

    Comment


    • #3
      Man, do I feel stupid now. Thanks for that. I'll chalk that one up to relying to heavily on auto imports from Eclipse!

      Comment

      Working...
      X