Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法绑定';集群&x27;至com.datastax.driver.core.Cluster_Java_Maven_Spring Boot_Cassandra - Fatal编程技术网

Java 无法绑定';集群&x27;至com.datastax.driver.core.Cluster

Java 无法绑定';集群&x27;至com.datastax.driver.core.Cluster,java,maven,spring-boot,cassandra,Java,Maven,Spring Boot,Cassandra,我在运行spring启动应用程序时遇到以下异常: Failed to bind properties under 'cluster' to com.datastax.driver.core.Cluster: Property: cluster Value: Origin: "cluster" from property source "class path resource [application.yml]" Reason: No converter fou

我在运行spring启动应用程序时遇到以下异常:

Failed to bind properties under 'cluster' to com.datastax.driver.core.Cluster:

    Property: cluster
    Value: 
    Origin: "cluster" from property source "class path resource [application.yml]"
    Reason: No converter found capable of converting from type [java.lang.String] to type [com.datastax.driver.core.Cluster]

Action:

Update your application's configuration
正在从领事处读取配置文件。因此,从错误描述中可以看出,属性“cluster”的值为空。但从文件中可以看到,config如下所示:

cassandra:
  host: abc:50126
  forceSchemaCreation: false
  cluster:
    name: test_cluster    
    user: test_user
    password: password    
    defaultFetchSize: 10000
    callback.executor.pool: 10
  • yml文件中是否存在语法错误? 或
  • 为什么错误会说“cluster”而不是“cassandra.cluster”?怀疑这一部分是正确的吗? 或
  • 说明中的“源”部分指向“类路径资源[application.yml]”。这应该引起关注吗
另外,由于运行应用程序时收到的“
命令行太长”
”消息,我在workspce文件中将“dynamic.classpath”设置为true。

yml文件中是否存在语法错误?
我在yml文件中没有看到任何错误

为什么错误会说“cluster”而不是“cassandra.cluster”?
说明中的“源”部分指向“类路径资源[application.yml]”。这应该引起关注吗?

请检查您是否在配置类上使用
@ConfigurationProperties
。如果是,请尝试将其删除(如果不需要)。只需
@Configuration
就可以在yml中自动关联所有全局属性。

是的,删除了注释ConfigurationProperties,并将其与配置一起使用。工作!