Announcement Announcement Module
Collapse
No announcement yet.
TwitterTemplate - jackson VerifyError Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • TwitterTemplate - jackson VerifyError

    I am trying to use spring-social to post status to Twitter via TwitterTemplate, getting this error. I dont have any jackson jar in the classpath. Any clue?

    Exception in thread "main" java.lang.VerifyError: (class: org/codehaus/jackson/map/ObjectMapper, method: writeValueAsBytes signature: (Ljava/lang/Object[B) Incompatible argument to function
    at org.springframework.http.converter.json.MappingJac ksonHttpMessageConverter.<init>(MappingJacksonHttp MessageConverter.java:56)
    at org.springframework.web.client.RestTemplate.<init> (RestTemplate.java:147)
    at org.springframework.web.client.RestTemplate.<init> (RestTemplate.java:162)
    at org.springframework.social.oauth1.ProtectedResourc eClientFactory.create(ProtectedResourceClientFacto ry.java:71)
    at org.springframework.social.oauth1.AbstractOAuth1Ap iBinding.<init>(AbstractOAuth1ApiBinding.java:63)
    at org.springframework.social.twitter.api.impl.Twitte rTemplate.<init>(TwitterTemplate.java:88)
    at SocialMain.main(SocialMain.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)

  • #2
    VerifyError indicates that the JVM found some inconsistency or security problem with the given class file; typically the case when you compile against one version of a class and then run against a different and incompatible version. From this, it appears to be complaining about the ObjectMapper.writeValueAsBytes() method from the Jackson library.

    You say you don't have the Jackson JAR in your classpath, but you must for it to be complaining this way--it's likely be complaining with a different exception. Even so, you *should* have Jackson in your classpath or else you'll have troubles working with TwitterTemplate (it needs Jackson to do the JSON parsing of results coming back from the Twitter API). If you're using Maven or Gradle, then Jackson should be pulled in transitively as it is a required dependency of spring-social-twitter (and it should pull in the correct version).

    I see you're running this via IntelliJ, but I don't know how you've created your project in your IDE. Are you importing a Maven/Gradle project or using any sort of IntelliJ support for Maven/Gradle dependency resolution? (Admittedly, I'm not an IntelliJ user, so I'm at a disadvantage to help out much with that aspect of your project.)

    Comment

    Working...
    X