我正在尝试使用EmbeddedCassandraServerHelper进行测试。这是我的设置代码

@BeforeClass
    public static void initCassandra() throws ConfigurationException{
        try {
            Properties prop = new Properties();
            prop.load(AbstractCassandraEmbeddedSetup.class.getClassLoader().getResourceAsStream("whi-cassandra.properties"));
            String cassandraHosts = prop.getProperty("cassandra.hosts");
            String cassandraPort = prop.getProperty("cassandra.port");

            try {
                EmbeddedCassandraServerHelper.startEmbeddedCassandra("test-cassandra.yml", 20000);
            } catch (ConfigurationException e) {
                logger.error("Could not start Embedded Cassandra Server");
                e.printStackTrace();
                throw e;
            }

            Cluster cluster = Cluster.builder().addContactPoints(cassandraHosts).withPort(Integer.parseInt(cassandraPort)).build();
            Session session = cluster.connect();

            session.execute(KEYSPACE_CREATION_QUERY);
            session.execute(KEYSPACE_ACTIVATE_QUERY);

        } catch (TTransportException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


这是属性文件

cassandra.contactpoints=127.0.0.1
cassandra.port=9142
cassandra.keyspace=testKeyspace


这是yml文件的一部分

listen_address: 127.0.0.1

start_native_transport: true
# port for the CQL native transport to listen for clients on
native_transport_port: 9142

# Whether to start the thrift rpc server.
start_rpc: true

# Address to broadcast to other Cassandra nodes
# Leaving this blank will set it to the same value as listen_address
# broadcast_address: 1.2.3.4

# The address to bind the Thrift RPC service to -- clients connect
# here. Unlike ListenAddress above, you *can* specify 0.0.0.0 here if
# you want Thrift to listen on all interfaces.
#
# Leaving this blank has the same effect it does for ListenAddress,
# (i.e. it will be based on the configured hostname of the node).
rpc_address: localhost
# port for Thrift to listen for clients on
rpc_port: 9175


但是,我在NoHostAvailableException

EmbeddedCassandraServerHelper.startEmbeddedCassandra("test-cassandra.yml", 20000);

这是堆栈跟踪

26-12-2017 11:31:43  INFO [pool-2-thread-1] (StorageService.java:535) - Populating token metadata from system tables
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:542) - Token metadata:
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:553) - Cassandra version: 3.9
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:554) - Thrift API version: 20.1.0
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:555) - CQL supported versions: 3.4.2 (default: 3.4.2)
26-12-2017 11:31:44  INFO [pool-2-thread-1] (IndexSummaryManager.java:85) - Initializing index summary manager with a memory pool size of 12 MB and a resize interval of 60 minutes
26-12-2017 11:31:44  INFO [pool-2-thread-1] (MessagingService.java:570) - Starting Messaging Service on /127.0.0.1:7010 (lo0)
26-12-2017 11:31:44  WARN [pool-2-thread-1] (SystemKeyspace.java:1063) - No host ID found, created c3dfd00f-8439-4fa2-b469-21b98e33ff29 (Note: This should happen exactly once per node).
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:687) - Loading persisted ring state
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:796) - Starting up server gossip
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:834) - This node will not auto bootstrap because it is configured to be a seed node.
26-12-2017 11:31:44  WARN [pool-2-thread-1] (StorageService.java:951) - Generated random token [5376418282286547064]. Random tokens will result in an unbalanced ring; see http://wiki.apache.org/cassandra/Operations
26-12-2017 11:31:44  INFO [pool-2-thread-1] (MigrationManager.java:302) - Create new Keyspace: KeyspaceMetadata{name=system_traces, params=KeyspaceParams{durable_writes=true, replication=ReplicationParams{class=org.apache.cassandra.locator.SimpleStrategy, replication_factor=2}}, tables=[org.apache.cassandra.config.CFMetaData@525e9b95[cfId=c5e99f16-8677-3914-b17e-960613512345,ksName=system_traces,cfName=sessions,flags=[COMPOUND],params=TableParams{comment=tracing sessions, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=0, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(),partitionColumns=[[] | [client command coordinator duration request started_at parameters]],partitionKeyColumns=[session_id],clusteringColumns=[],keyValidator=org.apache.cassandra.db.marshal.UUIDType,columnMetadata=[client, command, session_id, coordinator, request, started_at, duration, parameters],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@66c1e0de[cfId=8826e8e9-e16a-3728-8753-3bc1fc713c25,ksName=system_traces,cfName=events,flags=[COMPOUND],params=TableParams{comment=tracing events, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=0, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.TimeUUIDType),partitionColumns=[[] | [activity source source_elapsed thread]],partitionKeyColumns=[session_id],clusteringColumns=[event_id],keyValidator=org.apache.cassandra.db.marshal.UUIDType,columnMetadata=[activity, session_id, thread, event_id, source, source_elapsed],droppedColumns={},triggers=[],indexes=[]]], views=[], functions=[], types=[]}
26-12-2017 11:31:44  INFO [MigrationStage:1] (ViewManager.java:137) - Not submitting build tasks for views in keyspace system_traces as storage service is not initialized
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_traces.events
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_traces.sessions
26-12-2017 11:31:44  INFO [pool-2-thread-1] (MigrationManager.java:302) - Create new Keyspace: KeyspaceMetadata{name=system_distributed, params=KeyspaceParams{durable_writes=true, replication=ReplicationParams{class=org.apache.cassandra.locator.SimpleStrategy, replication_factor=3}}, tables=[org.apache.cassandra.config.CFMetaData@45d255f7[cfId=759fffad-624b-3181-80ee-fa9a52d1f627,ksName=system_distributed,cfName=repair_history,flags=[COMPOUND],params=TableParams{comment=Repair history, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=0, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.TimeUUIDType),partitionColumns=[[] | [coordinator exception_message exception_stacktrace finished_at parent_id range_begin range_end started_at status participants]],partitionKeyColumns=[keyspace_name, columnfamily_name],clusteringColumns=[id],keyValidator=org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type),columnMetadata=[status, id, coordinator, finished_at, participants, exception_stacktrace, parent_id, range_end, range_begin, exception_message, keyspace_name, started_at, columnfamily_name],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@3463aa95[cfId=deabd734-b99d-3b9c-92e5-fd92eb5abf14,ksName=system_distributed,cfName=parent_repair_history,flags=[COMPOUND],params=TableParams{comment=Repair history, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=0, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(),partitionColumns=[[] | [exception_message exception_stacktrace finished_at keyspace_name started_at columnfamily_names options requested_ranges successful_ranges]],partitionKeyColumns=[parent_id],clusteringColumns=[],keyValidator=org.apache.cassandra.db.marshal.TimeUUIDType,columnMetadata=[requested_ranges, exception_message, keyspace_name, successful_ranges, started_at, finished_at, options, exception_stacktrace, parent_id, columnfamily_names],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@72e284c7[cfId=5582b59f-8e4e-35e1-b913-3acada51eb04,ksName=system_distributed,cfName=view_build_status,flags=[COMPOUND],params=TableParams{comment=Materialized View build status, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=0, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.UUIDType),partitionColumns=[[] | [status]],partitionKeyColumns=[keyspace_name, view_name],clusteringColumns=[host_id],keyValidator=org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type),columnMetadata=[status, keyspace_name, view_name, host_id],droppedColumns={},triggers=[],indexes=[]]], views=[], functions=[], types=[]}
26-12-2017 11:31:44  INFO [MigrationStage:1] (ViewManager.java:137) - Not submitting build tasks for views in keyspace system_distributed as storage service is not initialized
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_distributed.parent_repair_history
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_distributed.repair_history
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_distributed.view_build_status
26-12-2017 11:31:44  INFO [pool-2-thread-1] (StorageService.java:2087) - Node /127.0.0.1 state jump to NORMAL
26-12-2017 11:31:44  INFO [pool-2-thread-1] (MigrationManager.java:302) - Create new Keyspace: KeyspaceMetadata{name=system_auth, params=KeyspaceParams{durable_writes=true, replication=ReplicationParams{class=org.apache.cassandra.locator.SimpleStrategy, replication_factor=1}}, tables=[org.apache.cassandra.config.CFMetaData@6d8318ac[cfId=5bc52802-de25-35ed-aeab-188eecebb090,ksName=system_auth,cfName=roles,flags=[COMPOUND],params=TableParams{comment=role definitions, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=7776000, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(),partitionColumns=[[] | [can_login is_superuser salted_hash member_of]],partitionKeyColumns=[role],clusteringColumns=[],keyValidator=org.apache.cassandra.db.marshal.UTF8Type,columnMetadata=[role, salted_hash, member_of, can_login, is_superuser],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@3f5de9a8[cfId=0ecdaa87-f8fb-3e60-88d1-74fb36fe5c0d,ksName=system_auth,cfName=role_members,flags=[COMPOUND],params=TableParams{comment=role memberships lookup table, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=7776000, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.UTF8Type),partitionColumns=[[] | []],partitionKeyColumns=[role],clusteringColumns=[member],keyValidator=org.apache.cassandra.db.marshal.UTF8Type,columnMetadata=[role, member],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@31076d99[cfId=3afbe79f-2194-31a7-add7-f5ab90d8ec9c,ksName=system_auth,cfName=role_permissions,flags=[COMPOUND],params=TableParams{comment=permissions granted to db roles, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=7776000, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.UTF8Type),partitionColumns=[[] | [permissions]],partitionKeyColumns=[role],clusteringColumns=[resource],keyValidator=org.apache.cassandra.db.marshal.UTF8Type,columnMetadata=[resource, role, permissions],droppedColumns={},triggers=[],indexes=[]], org.apache.cassandra.config.CFMetaData@11b5b7ba[cfId=5f2fbdad-91f1-3946-bd25-d5da3a5c35ec,ksName=system_auth,cfName=resource_role_permissons_index,flags=[COMPOUND],params=TableParams{comment=index of db roles with permissions granted on a resource, read_repair_chance=0.0, dclocal_read_repair_chance=0.0, bloom_filter_fp_chance=0.01, crc_check_chance=1.0, gc_grace_seconds=7776000, default_time_to_live=0, memtable_flush_period_in_ms=3600000, min_index_interval=128, max_index_interval=2048, speculative_retry=99PERCENTILE, caching={'keys' : 'ALL', 'rows_per_partition' : 'NONE'}, compaction=CompactionParams{class=org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy, options={min_threshold=4, max_threshold=32}}, compression=org.apache.cassandra.schema.CompressionParams@c82eb47f, extensions={}, cdc=false},comparator=comparator(org.apache.cassandra.db.marshal.UTF8Type),partitionColumns=[[] | []],partitionKeyColumns=[resource],clusteringColumns=[role],keyValidator=org.apache.cassandra.db.marshal.UTF8Type,columnMetadata=[resource, role],droppedColumns={},triggers=[],indexes=[]]], views=[], functions=[], types=[]}
26-12-2017 11:31:44  INFO [MigrationStage:1] (ViewManager.java:137) - Not submitting build tasks for views in keyspace system_auth as storage service is not initialized
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_auth.resource_role_permissons_index
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_auth.role_members
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_auth.role_permissions
26-12-2017 11:31:44  INFO [MigrationStage:1] (ColumnFamilyStore.java:412) - Initializing system_auth.roles
26-12-2017 11:31:44  INFO [pool-2-thread-1] (NativeTransportService.java:75) - Netty using Java NIO event loop
26-12-2017 11:31:44  INFO [pool-2-thread-1] (Server.java:159) - Using Netty Version: [netty-buffer=netty-buffer-4.1.19.Final.0786c4c, netty-codec=netty-codec-4.1.19.Final.0786c4c, netty-codec-dns=netty-codec-dns-4.1.19.Final.0786c4c, netty-codec-haproxy=netty-codec-haproxy-4.1.19.Final.0786c4c, netty-codec-http=netty-codec-http-4.1.19.Final.0786c4c, netty-codec-http2=netty-codec-http2-4.1.19.Final.0786c4c, netty-codec-memcache=netty-codec-memcache-4.1.19.Final.0786c4c, netty-codec-mqtt=netty-codec-mqtt-4.1.19.Final.0786c4c, netty-codec-redis=netty-codec-redis-4.1.19.Final.0786c4c, netty-codec-smtp=netty-codec-smtp-4.1.19.Final.0786c4c, netty-codec-socks=netty-codec-socks-4.1.19.Final.0786c4c, netty-codec-stomp=netty-codec-stomp-4.1.19.Final.0786c4c, netty-codec-xml=netty-codec-xml-4.1.19.Final.0786c4c, netty-common=netty-common-4.1.19.Final.0786c4c, netty-handler=netty-handler-4.1.19.Final.0786c4c, netty-handler-proxy=netty-handler-proxy-4.1.19.Final.0786c4c, netty-resolver=netty-resolver-4.1.19.Final.0786c4c, netty-resolver-dns=netty-resolver-dns-4.1.19.Final.0786c4c, netty-tcnative=netty-tcnative-2.0.7.Final.5b9e43b, netty-transport=netty-transport-4.1.19.Final.0786c4c, netty-transport-native-epoll=netty-transport-native-epoll-4.1.19.Final.0786c4c, netty-transport-native-kqueue=netty-transport-native-kqueue-4.1.19.Final.0786c4c8d9, netty-transport-native-unix-common=netty-transport-native-unix-common-4.1.19.Final.0786c4c, netty-transport-rxtx=netty-transport-rxtx-4.1.19.Final.0786c4c, netty-transport-sctp=netty-transport-sctp-4.1.19.Final.0786c4c, netty-transport-udt=netty-transport-udt-4.1.19.Final.0786c4c]
26-12-2017 11:31:44  INFO [pool-2-thread-1] (Server.java:160) - Starting listening for CQL clients on localhost/127.0.0.1:9142 (unencrypted)...
26-12-2017 11:31:45  INFO [pool-2-thread-1] (ThriftServer.java:119) - Binding thrift service to localhost/127.0.0.1:9175
26-12-2017 11:31:45  INFO [Thread-1] (ThriftServer.java:136) - Listening for thrift clients...
26-12-2017 11:31:45  INFO [Native-Transport-Requests-1] (ApproximateTime.java:44) - Scheduling approximate time-check task with a precision of 10 milliseconds
26-12-2017 11:31:54  WARN [OptionalTasks:1] (FBUtilities.java:338) - Trigger directory doesn't exist, please create it and try again.
26-12-2017 11:31:54  INFO [OptionalTasks:1] (CassandraRoleManager.java:339) - Created default superuser role 'cassandra'
26-12-2017 11:32:41 ERROR [main] (AbstractCassandraEmbeddedSetup.java:41) - Could not start Embedded Cassandra Server
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9142 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces))
    at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:223)
    at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:78)
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1230)
    at com.datastax.driver.core.Cluster.init(Cluster.java:157)
    at com.datastax.driver.core.Cluster.connect(Cluster.java:245)
    at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:148)
    at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:95)
    at org.cassandraunit.utils.EmbeddedCassandraServerHelper.startEmbeddedCassandra(EmbeddedCassandraServerHelper.java:74)
    at com.ibm.whi.breastadvisor.contoller.test.AbstractCassandraEmbeddedSetup.initCassandra(AbstractCassandraEmbeddedSetup.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
26-12-2017 11:33:53  INFO [main] (CassandraHostRetryService.java:50) - Downed Host Retry service started with queue size -1 and retry delay 10s
26-12-2017 11:33:53  INFO [main] (JmxMonitor.java:44) - Registering JMX me.prettyprint.cassandra.service_TestCluster:ServiceType=hector,MonitorType=hector
26-12-2017 11:33:53  INFO [StorageServiceShutdownHook] (ThriftServer.java:142) - Stop listening to thrift clients
26-12-2017 11:33:53  INFO [StorageServiceShutdownHook] (Server.java:180) - Stop listening for CQL clients
26-12-2017 11:33:53  INFO [StorageServiceShutdownHook] (Gossiper.java:1500) - Announcing shutdown
26-12-2017 11:33:53  INFO [StorageServiceShutdownHook] (StorageService.java:2087) - Node /127.0.0.1 state jump to shutdown
26-12-2017 11:33:55  INFO [StorageServiceShutdownHook] (MessagingService.java:799) - Waiting for messaging service to quiesce
26-12-2017 11:33:55  INFO [ACCEPT-/127.0.0.1] (MessagingService.java:1148) - MessagingService has terminated the accept() thread
26-12-2017 11:33:55  INFO [StorageServiceShutdownHook] (HintsService.java:212) - Paused hints dispatch
26-12-2017 11:33:55  INFO [StorageServiceShutdownHook] (HintsService.java:212) - Paused hints dispatch


请注意,似乎可以按照控制台上的这些行启动某些操作

26-12-2017 11:31:44  INFO [pool-2-thread-1] (Server.java:160) - Starting listening for CQL clients on localhost/127.0.0.1:9142 (unencrypted)...
26-12-2017 11:31:45  INFO [pool-2-thread-1] (ThriftServer.java:119) - Binding thrift service to localhost/127.0.0.1:9175


我对吗?为什么服务器关闭?我的配置有问题吗?
 另外,这就是我在pom中拥有的

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-cassandra</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.0.0.RELEASE</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.0.0.RELEASE</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.cassandraunit</groupId>
            <artifactId>cassandra-unit-spring</artifactId>
            <version>3.1.1.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.cassandraunit</groupId>
                    <artifactId>cassandra-unit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.cassandraunit</groupId>
            <artifactId>cassandra-unit</artifactId>
            <classifier>shaded</classifier>
            <version>3.1.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hectorclient</groupId>
            <artifactId>hector-core</artifactId>
            <version>2.0-0</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>2.1.5</version>
            <optional>true</optional>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.19.Final</version>
        </dependency>

最佳答案

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces

<dependency>
           <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>2.1.5</version>
            <optional>true</optional>
</dependency>



根据compatibility matrix,datastax cassandra驱动程序版本2.x与Cassandra 3不兼容。

我想您可以从pom中删除cassandra-driver-core依赖关系,因为spring-data-cassandra已经具有datastax驱动程序依赖关系。

10-02 05:08