spring数据cassandra无法从application.yml示例化重新连接策略

ymzxtsji  于 2021-06-15  发布在  Cassandra
关注(0)|答案(0)|浏览(412)

我使用springbootapplication.yml和autoconfiguration配置了我的springdatacassandra客户机。
它适用于我,但仅当我不使用spring.data.reconnection-policy属性时。当我使用其中任何一个(com.datastax.driver.core.policies.constantreconnectionpolicy或com.datastax.driver.core.policies.exponentialreconnectionpolicy)时,启动时出现以下错误:
原因:org.springframework.beans.beaninstantiationexception:未能示例化[com.datastax.driver.core.policies.constantreconnectionpolicy]:未找到默认构造函数;嵌套的异常是java.lang.nosuchmethodexception:com.datastax.driver.core.policies.constantreconnectionpolicy.()位于org.springframework.beans.beanutils.instanceClass(beanutils)。java:127)~[spring-beans-5.0.7.发行版。jar:5.0.7.release]在org.springframework.boot.context.properties.propertymapper$source.lambda$as$2(propertymapper。java:207) ~[spring-boot-2.0.3.版本。jar:2.0.3.release]在org.springframework.boot.context.properties.propertymapper$source.to(propertymapper。java:302)~[spring-boot-2.0.3.版本。jar:2.0.3.release]在org.springframework.boot.autoconfigure.cassandra.cassandraautoconfiguration.cassandracluster(cassandraautoconfiguration。java:77) ~[spring-boot-autoconfigure-2.0.3.发布。jar:2.0.3.release]在org.springframework.boot.autoconfigure.cassandra.cassandraautoconfiguration$$enhancerbyspringcglib$$2f475e40.cglib$cassandracluster$0()~[spring-boot-autoconfigure-2.0.3.release。jar:2.0.3.release]
我扩展了policy类并在其中添加了默认构造函数。在我的application.yml中有了新类,一切正常。是否可以在没有解决方法的情况下配置重新连接策略,或者这是一个错误?
提前谢谢。
这是我的申请表
spring:data:cassandra:#cassandra集群的名称。集群名称:“测试集群”


# Cluster node addresses.

  contact-points: 10.247.198.137

  # Login user of the server.
  username: cassandra

  # Login password of the server.
  password: cassandra

  # Compression supported by the Cassandra binary protocol.
  compression: none

 # Port of the Cassandra server.
  port: 9042

  # Socket option: connection time out.
  connect-timeout: 5000ms

  # Queries consistency level.
  consistency-level: three

  # Queries default fetch size.
  fetch-size: 5000

  # Keyspace name to use.
  keyspace-name: testkeyspace

  # Enable SSL support.
  ssl: true

  # Class name of the load balancing policy.
  load-balancing-policy: com.datastax.driver.core.policies.RoundRobinPolicy

  # Reconnection policy class.
  reconnection-policy: com.datastax.driver.core.policies.ConstantReconnectionPolicy

  # Class name of the retry policy.
  retry-policy: com.datastax.driver.core.policies.DefaultRetryPolicy

  # Heartbeat interval after which a message is sent on an idle connection to make sure it's still alive. If a duration suffix is not specified, seconds will be used.
  pool.heartbeat-interval: 30s

  # Idle timeout before an idle connection is removed. If a duration suffix is not specified, seconds will be used.
  pool.idle-timeout: 120s

  # Maximum number of requests that get queued if no connection is available.
  pool.max-queue-size: 256

  # Pool timeout when trying to acquire a connection from a host's pool.
  pool.pool-timeout: 5000ms

  # Socket option: read time out.
  read-timeout: 5000ms

  # Type of Cassandra repositories to enable.
  repositories.type: auto

  # Queries serial consistency level.
  serial-consistency-level: three

  # Schema action to take at startup.
  schema-action: RECREATE_DROP_UNUSED

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题