このエラーを修正するためにできる限りのことを行い、pom ファイルにいくつかの除外を追加しましたが、それでもこのエラーが発生する理由を理解できません。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo.project</groupId>
<artifactId>demoApi</artifactId>
<version>4.3.0.BUILD-SNAPSHOT</version>
<name>demoApi</name>
<description>HTTP REST WebService</description>
<properties>
<spring.version>4.2.5.RELEASE</spring.version>
<spring.integration.version>4.2.5.RELEASE</spring.integration.version>
<spring.security.version>4.0.4.RELEASE</spring.security.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>${spring.integration.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-http</artifactId>
<version>${spring.integration.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-webmvc</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-webmvc</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-web</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-beans</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-core</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-context</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency> -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
</dependencies>
<packaging>war</packaging>
<build>
<finalName>demoApi</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
このエラーが発生するコード
package org.springframework.integration.samples.rest.json.view;
import java.util.Map;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
/**
* ExtendedMappingJacksonJsonView.java: This class extends the Spring's MappingJacksonJsonView
* <p>
* Note: The source code for this class is taken from the forum posted by AhungerArtist
* at http://forum.springsource.org/archive/index.php/t-84006.html
* <p>
* @author Vigil Bose
* @author Gary Russell
*/
public class ExtendedMappingJacksonJsonView extends MappingJackson2JsonView {
@SuppressWarnings({"rawtypes" })
@Override
protected Object filterModel(Map<String, Object> model){
Object result = super.filterModel(model);
if (!(result instanceof Map)){
return result;
}
Map map = (Map) result;
if (map.size() == 1){
return map.values().toArray()[0];
}
return map;
}
}
EDIT : 依存関係ツリーの出力
[INFO]com.demo.project:demoApi:war:4.3.0.BUILD-SNAPSHOT
[INFO] +- org.springframework:spring-oxm:jar:4.2.5.RELEASE:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] +- org.springframework:spring-test:jar:4.2.5.RELEASE:test
[INFO] +- org.springframework.integration:spring-integration-core:jar:4.2.5.RELE
ASE:compile
[INFO] +- org.springframework.integration:spring-integration-http:jar:4.2.5.RELE
ASE:compile
[INFO] +- org.springframework:spring-aop:jar:4.2.5.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:4.2.5.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:4.2.5.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.5.RELEASE:compile
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] +- org.jasypt:jasypt:jar:1.7:compile
[INFO] +- org.springframework:spring-tx:jar:4.2.5.RELEASE:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.0.4.RELEASE:
compile
[INFO] +- org.springframework.security:spring-security-web:jar:4.0.4.RELEASE:com
pile
[INFO] +- org.mockito:mockito-core:jar:1.9.5:test
[INFO] +- org.springframework:spring-jdbc:jar:4.2.5.RELEASE:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] +- com.oracle:ojdbc6:jar:11.2.0:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] \- javax.inject:javax.inject:jar:1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.143 s
[INFO] Finished at: 2016-05-04T13:44:59+05:30
[INFO] Final Memory: 14M/197M
[INFO] ------------------------------------------------------------------------
編集 2:重要なことに言及するのを忘れていました。Maven リポジトリは使用していませんが、代わりに独自のプライベート リポジトリを使用しています。すべての jar をダウンロードし、リポジトリにインポートしました。mvn clean -U install
エラーがないかどうかを確認して修正するために繰り返し実行しました。
答えてくれてありがとう。早く終わらせないといけないので、JAX-RSではなくSpring WSを使うことにしました!Spring REST WS はすでに動作しているため、さらに使用することにしました。私の組織だけがプライベート リポジトリを使用するという考えを捨てていれば、私はこの混乱に巻き込まれることはなかったでしょう。