简体   繁体   English

Spring 中嵌入式模式下的 SymmetricDS 作为客户端启动应用程序

[英]SymmetricDS in Embedded mode in Spring boot app as client

I have a Spring boot app using SymmetricDS.我有一个使用 SymmetricDS 的 Spring 启动应用程序。 When I want to start a server, and a clients with h2 databases, both in embedded mode.当我想以嵌入式模式启动服务器和具有 h2 数据库的客户端时。

I created the config files what are read, but the client throws the following error:我创建了读取的配置文件,但客户端抛出以下错误:

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'postgresBulkLoaderFactory' defined in class path resource [symmetric-ext-points.xml]:
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.jumpmind.symmetric.ext.PostgresBulkDataLoaderFactory]: 
Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: 
org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractor

When debugging the config is read for sure.调试时肯定会读取配置。 The DB is a H2 database, but by debugging it looks like that SymmetricDS can't find the H2 driver, and It goes back to use Postgresql as default. DB是一个H2数据库,但是通过调试,SymmetricDS好像找不到H2驱动,又回到默认使用Postgresql。

My gradle looks like this:我的 gradle 看起来像这样:

 compile group: 'org.jumpmind.symmetric', name: 'symmetric-server', version: '3.5.19'
 compile group: 'org.jumpmind.symmetric', name: 'symmetric-client', version: '3.5.19'
 compile group: 'org.jumpmind.symmetric', name: 'symmetric-core', version: '3.5.19'

Why can't it use the my H2 database?为什么它不能使用我的 H2 数据库? Checking maven repository the core should have the h2 driver but the error is still thrown.检查 maven 存储库,核心应该有 h2 驱动程序,但仍然会抛出错误。

Why are you using such an old version of SymmetricDS?为什么要使用这么旧版本的 SymmetricDS? The latest is 3.11.8.最新的是 3.11.8。

When I embed SymmetricDS I exclude dependencies that might interfere with dependencies provided by Spring Boot.当我嵌入 SymmetricDS 时,我排除了可能干扰 Spring Boot 提供的依赖项的依赖项。 For example:例如:

compile ("org.jumpmind.symmetric:symmetric-server:$symmetricVersion") {
     exclude group: 'org.slf4j'
     exclude group: 'com.mangofactory', module: 'swagger-springmvc'
     exclude group: 'org.springframework'
     exclude group: 'net.java.dev.jna'
}

This is with the following version of Spring Boot and Spring:这是以下版本的 Spring Boot 和 Spring:

springBootVersion=2.1.3.RELEASE
springVersion=5.1.5.RELEASE

If you are interested here is an example of how we embed SymmetricDS in Spring Boot:如果您有兴趣,这里是我们如何将 SymmetricDS 嵌入 Spring Boot 的示例:

SymetricWebServer not starting in embedded mode SymetricWebServer 未以嵌入式模式启动

The class org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor is not on the classpath. class org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor不在类路径中。 I'd recommend trying adding to the list of dependencies a jar from Spring that contains this class, for example: https://www.findjar.com/class/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractor.html我建议尝试将 jar 添加到包含此 class 的 jar 的依赖项列表中,例如: https://www.findjar.com/class/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractor.8854178647

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM