spring-data-cassandra を使用しているときに、pom.xml で問題が発生しました。
私のpom.xmlは次のようになります-
<properties>
<java-version>1.6</java-version>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.6.6</org.slf4j-version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<!-- Cassandra -->
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-cassandra</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
私のメインコントローラクラスは以下のようなものです -
public String insertEmp(Locale locale, Model model, @ModelAttribute Employee emp) {
logger.info("Create method in home controller", locale);
String serverIP = "127.0.0.1";
String keyspace = "jetset";
Cluster cluster = Cluster.builder()
.addContactPoints(serverIP)
.build();
Session session = cluster.connect(keyspace);
CassandraOperations cassandraTemplate = new CassandraTemplate(session);
model.addAttribute("serverTime", "Test" );
//employeeService.createEmployee(emp);
cassandraTemplate.insert(emp);
return "admin/index";
}
プログラムを実行しているときに、エラーが発生しています-
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/DefaultParameterNameDiscoverer
at org.springframework.data.mapping.model.PreferredConstructorDiscoverer.<init>(PreferredConstructorDiscoverer.java:38) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.mapping.model.BasicPersistentEntity.<init>(BasicPersistentEntity.java:92) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.cassandra.mapping.BasicCassandraPersistentEntity.<init>(BasicCassandraPersistentEntity.java:83) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.createPersistentEntity(BasicCassandraMappingContext.java:123) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.cassandra.mapping.BasicCassandraMappingContext.createPersistentEntity(BasicCassandraMappingContext.java:54) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:299) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:179) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:139) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.mapping.context.AbstractMappingContext.getPersistentEntity(AbstractMappingContext.java:66) ~[spring-data-commons-1.11.0.RELEASE.jar:na]
at org.springframework.data.cassandra.core.CassandraTemplate.getTableName(CassandraTemplate.java:217) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.cassandra.core.CassandraTemplate.doInsert(CassandraTemplate.java:641) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.cassandra.core.CassandraTemplate.insert(CassandraTemplate.java:237) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.springframework.data.cassandra.core.CassandraTemplate.insert(CassandraTemplate.java:232) ~[spring-data-cassandra-1.3.0.RELEASE.jar:na]
at org.jetset.estate.HomeController.insertEmp(HomeController.java:91) ~[classes/:na]
これはポンの問題のように見えますが、私はそれを理解することができません。
提案してください。
ありがとう。
AJ