Gábor Csikós
Gábor Csikós

Reputation: 2927

SymmetricDS in Embedded mode in Spring boot app as client

I have a Spring boot app using SymmetricDS. When I want to start a server, and a clients with h2 databases, both in embedded mode.

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.

My gradle looks like this:

 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? Checking maven repository the core should have the h2 driver but the error is still thrown.

Upvotes: 2

Views: 377

Answers (2)

chenson42
chenson42

Reputation: 1108

Why are you using such an old version of SymmetricDS? The latest is 3.11.8.

When I embed SymmetricDS I exclude dependencies that might interfere with dependencies provided by 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:

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:

SymetricWebServer not starting in embedded mode

Upvotes: 2

Boris Pavlović
Boris Pavlović

Reputation: 64640

The class org.springframework.jdbc.support.nativejdbc.NativeJdbcExtractor is not on the classpath. 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

Upvotes: 1

Related Questions