开发者

What is correct version or jackson for spring?

I am using jackson converter (MappingJacksonHttpMessageConverter) to consume and produce json data from spring controller. But while invoking controller throws following exception.

Caused by: java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.isConcrete()Z
 at org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:80)
 at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:266)
 at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:198)
 at org.codehaus.jackson.map.deser.StdDeserializerProvider.hasValueDeserializerFor(StdDeserializerProvider.java:152)
 at org.codehaus.jackson.map.ObjectMapper.canDeserialize(ObjectMapper.java:829)

My code:

Spring bean file:

abc.CartType abc.CartResponseType

pom file (snippets only)

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <compileSource>1.5</compileSource>
  <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
  <jboss.server.name>network-epro</jboss.server.name>
 </properties>


  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-core</artifactId>
   <version>${org.springframework.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-beans</artifactId>
   <version>${org.springframework.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-context</artifactId>
   <version>${org.springframework.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-web</artifactId>
   <version>${org.springframework.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-webmvc</artifactId>
   <version>${org.springframework.version}</version>
  </dependency>
  <dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-test</artifactId>
   <version>${org.springframework.version}</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>servlet-api</artifactId>
   <version>2.4</version>
   <scope>provided</scope>
  </dependency>
  <dependency>
   <groupId>javax.servlet.jsp</groupId>
   <artifactId>jsp-api</artifactId>
   <version>2.1</version>
   <scope>provided</scope>
  </dependency>
  <dependency>
   <groupId>taglibs</groupId>
   <artifactId>standard</artifactId>
   <version>1.1.2</version>
  </dependency>
  <dependency>
   <groupId>jstl</groupId>
   <artifactId>jstl</artifactId>
   <version>1.1.2</version>
  </dependency>
  <dependency>
   <groupId>org.apache.tiles</groupId>
   <artifactId>tiles-api</artifactId>
   <version>2.1.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.tiles</groupId>
   <artifactId>tiles-core</artifactId>
   <version>2.1.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.tiles</groupId>
   <artifactId>tiles-jsp</artifactId>
   <version>2.1.4</version>
  </dependency>
  <dependency>
   <groupId>commons-lang</groupId>
   <artifactId>commons-lang</artifactId>
   <version>2.2</version>
  </dependency>
  <dependency>
   <groupId>commons-logging</groupId>
   <artifactId>commons-logging</artifactId>
   <version>1.1.1</version>
  </dependency>
  <dependency>
   <groupId>commons-collections</groupId>
   <artifactId>commons-collections</artifactId>
   <version>3.2</version>
  </dependency>
  <dependency>
   <groupId>sso</groupId>
   <artifactId>casclient</artifactId>
   <version>2.2.1</version>
  </dependency>
  <dependency>
   <groupId>com.sun.jersey</groupId>
   <artifactId>jersey-client</artifactId>
   <version>1.1.5.1</version>
  </dependency>
  <dependency>
   <groupId>commons-codec</groupId>
   <artifactId>commons-codec</artifactId>
   <version>1.3</version>
  </dependency>
  <dependency>
   <groupId>com.sun.xml.bind</groupId>
   <artifactId>jaxb-impl</artifactId>
   <version>2.2</version>
  </dependency>
  <dependency>
   <groupId>log4j</groupId>
   <artifactId>log4j</artifactId>
   <version>1.2.15</version>
   <exclusions>
    <exclusion>
     <groupId>com.sun.jdmk</groupId>
     <artifactId>jmxtools</artifactId>
    </exclusion>
    <exclusion>
     <groupId>com.sun.jmx</groupId>
     <artifactId>jmxri</artifactId>
    </exclusion>
    <exclusion>
     <groupId>javax.jms</groupId>
     <artifactId>jms</artifactId>
    </exclusion>
    <exclusion>
     <groupId>commons-logging</groupId>
     <artifactId>commons-logging</artifactId>
    </exclusion>
   </exclusions>
  </dependency>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.5</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>net.sf.json-lib</groupId>
   <artifactId>json-lib-ext-spring</artifactId>
   <version>1.0.2</version>
  </dependency>

  <dependency>
   开发者_开发知识库 <groupId>xpp</groupId>
    <artifactId>xpp</artifactId>
    <version>2.3.0</version>
  </dependency>

  <!-- http://code.google.com/p/jsonp-java/ -->
  <dependency>
   <groupId>org.jsonp</groupId>
   <artifactId>jsonp</artifactId>
   <version>1.0.1</version>
  </dependency>
  <dependency>
   <groupId>email</groupId>
   <artifactId>email-client</artifactId>
   <version>2.0.0</version>
   <scope>provided</scope>
  </dependency>
    <dependency>
        <groupId>velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.4</version>
    </dependency>
  <dependency>
   <groupId>cglib</groupId>
   <artifactId>cglib</artifactId>
   <version>2.2</version>
   <type>jar</type>
   <scope>compile</scope>
  </dependency>
  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate</artifactId>
   <version>3.2.2.ga</version>
   <type>jar</type>
   <scope>compile</scope>
  </dependency>
  <!--  
   Jboss client dependancy. 
   -->
  <dependency>
   <groupId>jboss</groupId>
   <artifactId>jbossall-client</artifactId>
   <version>4.2.2.GA</version>
   <scope>provided</scope>
  </dependency>
  <dependency>
      <groupId>org.codehaus.jackson</groupId>
   <artifactId>jackson-mapper-asl</artifactId>
   <version>1.4.2</version>
  </dependency>
  <dependency>
      <groupId>org.springframework.ws</groupId>
      <artifactId>spring-oxm-tiger</artifactId>
      <version>1.5.9</version>
  </dependency>

I can see in spring-web pom file jackson version is mentioned as 1.4.2 and same I have used still it is throwing exception regarding method not found. Am I using correct version?


You seem to be missing the jackson-core dependency. You need that as well as jackson-mapper.

The 1.4.x version should be fine, although it shouldn't hurt to upgrade it to something more recent.


I think you have differing versions between Jackson core and mapper jars (former has streaming parser/generator; latter data binding). It is hard to ensure that transitive dependencies have compatible versions -- while multiple Jackson versions work just fine with Spring (and most other frameworks), versions of mapper and core have bit stricter dependencies.

Specifically: version of core should not be much older than version of mapper, as newer mapper versions depend on new features in core. Reverse matters less; so it is generally fine to have older mapper version, newer core (core also changes at much slower pace at this point).


I found the problem.

Use Jacson version 1.4.2 should not have problem and as StaxMan suggested core is dependably for mapper so it will be automatically resolved no need to declare it explicitly.

Now coming back to problem. It is classpath issue within jboss. I have two web application deployed in same server one with dependency on jacson versioin 1.1.1 and other one with 1.4.2. I dont yet have solution, So I have posted another question related to Jboss.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜