NoSuchMethodError: org.codehaus.jackson.type.JavaType

混江龙づ霸主 提交于 2020-01-02 04:45:33

问题


My application is throwing the error below, although I have in my app the jackson-core-asl-1.4.2 and jackson-mapper-asl-1.4.2

Caused by: java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.<init>(Ljava/lang/Class;)V
    at org.codehaus.jackson.map.type.SimpleType.<init>(SimpleType.java:32)
    at org.codehaus.jackson.map.type.TypeFactory._fromClass(TypeFactory.java:254)
    at org.codehaus.jackson.map.type.TypeFactory._fromType(TypeFactory.java:266)
    at org.codehaus.jackson.map.type.TypeFactory.type(TypeFactory.java:57)
    at org.codehaus.jackson.map.ObjectMapper.<clinit>(ObjectMapper.java:49)
    at org.springframework.web.servlet.view.json.MappingJacksonJsonView.<init>(MappingJacksonJsonView.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_(Runtime.java:126)
    at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:134)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 48 more
.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance_(Runtime.java:126)
    at com.google.appengine.tools.development.agent.runtime.Runtime.newInstance(Runtime.java:134)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
    ... 48 more

What could be the reason? It's really weird the application worked before and commited the codes to SVN then when I check-out and re-run everything I get this error...


回答1:


This looks almost certainly to be due to incompatible versions of 'core' and 'mapper' jars. You probably have incompatible versions in use via classpath.




回答2:


The problem you are having is due to an update in Google App Engine SDK (I think 1.6.1?).

I had the same problem, so I ran TattleTale to see if there are some dependency issues. Lo and behold, there is a conflict on the org.codehaus.* with the following 2 libraries:

  • google_sql.jar
  • jackson-core-asl-1.6.3.jar

While your jackson libraries are slightly different than mine, the issue remains the same. There are 2 fixes to this issue:

  • Remove google_sql.jar from war/webinf/lib directory. This will cause the SDK to fail validation checks, but if you ignore the red x's your code should run fine.
  • Update your GAE SDK to 1.6.2 or above. I think they fixed the issue in later SDK's but the updates also introduced some compiler warnings so look before you leap.


来源:https://stackoverflow.com/questions/11784051/nosuchmethoderror-org-codehaus-jackson-type-javatype

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!