【问题标题】:Spring Data Cassandra - Environment must not be null ErrorSpring Data Cassandra - 环境不能为空错误
【发布时间】:2014-10-30 10:47:58
【问题描述】:

我正在学习 Spring Data Cassandra 参考 http://docs.spring.io/spring-data/cassandra/docs/1.1.0.RC1/reference/html/ 的基本教程,但遇到了以下异常

java.lang.IllegalArgumentException: Environment must not be null!
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.data.repository.config.RepositoryConfigurationSourceSupport.<init>(RepositoryConfigurationSourceSupport.java:50)
    at org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.<init>(AnnotationRepositoryConfigurationSource.java:74)
    at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:74)
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:394)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:204)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:163)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:138)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:284)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:73)
    at com.strides.platform.domain.UserRepositoryDaoTest.<init>(UserRepositoryDaoTest.java:28)

我已完成文档中提到的步骤,

1) 使用 Cassandra 属性

2) 创建 Java 配置

3) 创建域和存储库类

我在测试类中有自动装配的环境变量。我检查了几个示例项目,不确定还需要做什么。

【问题讨论】:

    标签: spring-data spring-data-cassandra


    【解决方案1】:

    我遇到了这个错误消息,发现这个问题只在我使用 Spring Framework 版本 3.2.8.RELEASE 时出现。

    我的解决方案是升级到版本 3.2.9.RELEASE。

    另见java.lang.IllegalArgumentException: Environment must not be null

    【讨论】:

      猜你喜欢
      • 2015-07-04
      • 1970-01-01
      • 2016-02-05
      • 2017-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-01
      • 2016-08-20
      相关资源
      最近更新 更多