我有两个键格。其中一个是完美创建的,但另一个只是用SimpleReplication创建的。当我用网络复制创建它时,它被创建了,但当我在cqlsh中描述keyspace时,它返回:
“nonetype”对象没有属性“export_for_schema”
[CREATE KEYSPACE IF NOT EXISTS a_events_local WITH replication = { 'class' : 'NetworkTopologyStrategy', 'dс1' : 3, 'dс2' : 3 }
public abstract class CassandraConfig extends AbstractCassandraConfiguration {
@Value("${cassandra.host}")
private String host;
@Value("${cassandra.port}")
private int port;
@Value("${cassandra.user}")
private String usr;
@Value("${cassandra.psswd}")
private String psswd;
@Value("${cassandra.keyspace.a}")
private String keyspaceA;
@Value("${cassandra.keyspace.b}")
private String keyspaceB;
@Override
@Bean
public CassandraClusterFactoryBean cluster() {
CassandraClusterFactoryBean cluster =
new CassandraClusterFactoryBean();
cluster.setContactPoints(host);
cluster.setPort(port);
cluster.setUsername(usr);
cluster.setPassword(psswd);
cluster.setKeyspaceCreations(getKeyspaceCreations());
cluster.setJmxReportingEnabled(false);
return cluster;
}
@Override
protected String getContactPoints() {
return host;
}
@Override
protected int getPort() {
return port;
}
@Override
public SchemaAction getSchemaAction() {
return SchemaAction.NONE;
}
@Override
protected List<CreateKeyspaceSpecification> getKeyspaceCreations() {
return Arrays.asList(getAKeySpaceSpecification(), getBKeySpaceSpecification());
}
private CreateKeyspaceSpecification getAKeySpaceSpecification() {
return CreateKeyspaceSpecification.createKeyspace(keyspaceA)
.ifNotExists(true)
//.withSimpleReplication(3);
.withNetworkReplication(DataCenterReplication.of("dс1", 3) , DataCenterReplication.of("dс2", 3));
}
private CreateKeyspaceSpecification getBKeySpaceSpecification() {
return CreateKeyspaceSpecification.createKeyspace(keyspaceB)
.ifNotExists(true)
.withNetworkReplication(DataCenterReplication.of("dc1", 3), DataCenterReplication.of("dc2", 3));
}
@Configuration
@EnableCassandraRepositories(
cassandraTemplateRef = "keyspaceACassandraTemplate")
public class CassandraDDConfig extends CassandraConfig {
@Value("${cassandra.keyspace.a}")
private String keyspace;
@Value("${cassandra.a-entities-package}")
private String aEntityPackage;
@Override
@Bean("keyspaceDDSession")
public CassandraSessionFactoryBean session() {
CassandraSessionFactoryBean session = new CassandraSessionFactoryBean();
session.setCluster(cluster().getObject());
session.setConverter(cassandraConverter());
session.setKeyspaceName(getKeyspaceName());
session.setSchemaAction(getSchemaAction());
session.setStartupScripts(getStartupScripts());
session.setShutdownScripts(getShutdownScripts());
return session;
}
@Override
@Bean("keyspaceACassandraTemplate")
public CassandraAdminTemplate cassandraTemplate() throws Exception {
return new CassandraAdminTemplate(this.session().getObject(), cassandraConverter());
}
@Override
protected String getKeyspaceName() {
return keyspace;
}
@Override
public String[] getEntityBasePackages() {
return new String[] {aEntityPackage};
}
}
@Configuration
@EnableCassandraRepositories(
cassandraTemplateRef = "keyspaceBCassandraTemplate")
public class CassandraSparkConfig extends CassandraConfig {
@Value("${cassandra.keyspace.b}")
private String keyspace;
@Value("${cassandra.b-entities-package}")
private String dcEntityPackage;
@Override
@Bean("keyspaceBSession")
public CassandraSessionFactoryBean session() {
CassandraSessionFactoryBean session = new CassandraSessionFactoryBean();
session.setCluster(cluster().getObject());
session.setConverter(cassandraConverter());
session.setKeyspaceName(getKeyspaceName());
session.setSchemaAction(getSchemaAction());
session.setStartupScripts(getStartupScripts());
session.setShutdownScripts(getShutdownScripts());
return session;
}
@Override
@Bean("keyspaceSparkCassandraTemplate")
public CassandraAdminTemplate cassandraTemplate() throws Exception {
return new CassandraAdminTemplate(this.session().getObject(), cassandraConverter());
}
@Override
protected String getKeyspaceName() {
return keyspace;
}
@Override
public String[] getEntityBasePackages() {
String[] entities = new String[1];
if(saveAll){
entities[0] = bEntityPackage;
}
return entities;
}
}
最后,我使用getStartupScripts来创建密钥空间。它的工作原理是,数据被写入和从相应的表中读取。
@Override
@Bean
public CassandraClusterFactoryBean cluster() {
CassandraClusterFactoryBean cluster =
new CassandraClusterFactoryBean();
cluster.setContactPoints(host);
cluster.setPort(port);
cluster.setUsername(usr);
cluster.setPassword(psswd);
cluster.setStartupScripts(getStartupScripts());
cluster.setJmxReportingEnabled(false);
cluster.setMetricsEnabled(false);
@Override
protected List<String> getStartupScripts() {
final String scriptCreateAkeyspace =
"CREATE KEYSPACE IF NOT EXISTS "
+ keyspaceA
+ " WITH durable_writes = true"
+ " AND replication = {'class' : 'NetworkTopologyStrategy', 'dc1' : 3, 'dc2' : 1 };";
final String scriptCreateSparkKeyspace = "CREATE KEYSPACE IF NOT EXISTS "
+ keyspaceB
+ " WITH durable_writes = true"
+ " AND replication = {'class' : 'NetworkTopologyStrategy', 'dc1' : 1, 'dc2' : 3 };";
return Arrays.asList(scriptCreateAkeyspace, scriptCreateBKeyspace);
}
我在Tomcat中得到以下错误: 我已经在JBOSS和嵌入式tomcat服务器中运行了这个,但仍然出现了这个错误。我甚至从war中取出jar文件,并从JBOSS中运行它,仍然得到相同的错误。 我能够创建EntityMangers,但在创建它们之前,我得到了上面的错误。程序继续运行比抱怨类不是托管类型。但是,这些正在被扫描。 我在JBoss中得到了同样的错误: 第二数据源 application.y
我有使用数据库的主要数据源,它使用一些连接池。现在我想创建第二个数据源,它将使用相同的连接池在单独的事务中执行日志记录操作,然后是主数据库事务!据我从Glassfish文档中了解,如果多个数据源使用相同的连接池,那么它们将共享一个事务,直到连接未关闭为止(我可能错了,请纠正我)。 那么,在连接到数据源时,是否有方法启动新事务?通过设置TransactionIsolation可能是? 通过以下方式检
我试图使用JTA数据源实例化EntityManager,但我总是得到NullPointerException。这是我的环境:服务器:JBossas7.0JPA:2.0DB:MySQL 坚持不懈xml 在dao类中,我尝试以下方法: 但是当我使用它的getter时,我在这里得到NullPointerExctive: 调试显示它为空。 以下是standalone.xml中的数据源定义: "mysql"
错误: unsatisfiedDependencyException:创建名为“app controller”的bean时出错:通过字段“service”表示的未满足的依赖关系;嵌套异常为org.springframework.beans.factory.unsatisfieddependencyexception:创建名为“jenkins service”的bean时出错:通过字段“repo”表
我想使用PKCS7容器在PDF文件中创建分离签名。数据(哈希)是预先在另一个设备上用私钥签名的。我想创建一个PKCS7,其中包含签名的数据以及带有公钥的证书。如果不提供私钥并让库签名数据,我似乎无法创建带有bouncy castle的PKCS7。这似乎不起作用:
桑谢·萨赫德娃