java-spring的正确版本或杰克逊是什么?

前端之家收集整理的这篇文章主要介绍了java-spring的正确版本或杰克逊是什么? 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在使用杰克逊转换器(MappingJacksonHttpMessageConverter)来使用和产生来自spring控制器的json数据.但是在调用控制器时会引发以下异常.

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)

我的代码

Spring bean文件

  
   
    
    
    
    
    
     
     
    
  
 

 
 
 
 
 
  
  
 

   
    abc.CartType
    abc.CartResponseType
   
  

pom文件(仅片段)

<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>

我可以在spring-web pom文件中看到jackson版本被提到为1.4.2,并且我仍然使用过它关于未找到的方法抛出异常.我使用的版本正确吗?

最佳答案
您似乎缺少杰克逊核心的依赖关系.您还需要杰克逊映射器.

1.4.x版本应该很好,尽管将其升级到最新版本也不会受到损害.

原文链接:https://www.f2er.com/spring/531691.html

猜你在找的Spring相关文章