Compatibility with spring-boot 3.
mshima opened this issue · 7 comments
liquibase-neo4j is not compatible with spring-boot 3.
- neo4j jdbc url is not detected by spring-boot autoconfigure.
- built is driver fail using a SimpleDataSource fails with SpringLiquibase
- https://github.com/neo4j-contrib/neo4j-jdbc conflicts with spring-data-neo4j.
Related to jhipster/generator-jhipster#17956
Hello, thanks for the report.
You should not use neo4j-contrib/neo4j-jdbc
, since Liquibase Neo4j now implements its own JDBC connectivity layer.
The internal JDBC Driver used by Liquibase Neo4j is however not registered on purpose, see this particular documentation section.
The JDBC re-implementation is built for Liquibase purposes and registering the JDBC Driver
instance with DriverManager
would make it leak outside Liquibase which is not desirable.
@mshima if that helps, I can make myself available for a call and we can try to sort these problems out together (my email is first name dot last name at neo4j dot com).
The current approach is:
var datasource = new SimpleDriverDataSource(new Neo4jDriver(), "jdbc:neo4j:neo4j://localhost"); // https://github.com/spring-projects/spring-framework/blob/main/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/SimpleDriverDataSource.java
Properties properties = new Properties();
properties.setProperty("user", "neo4j");
datasource.setConnectionProperties(properties);
var springLiquibase = new SpringLiquibase();
springLiquibase.setDatasource(datasource);
I will create a repro later.
Oh, you mean this particular snippet does not work? If so, that's indeed something that needs fixing.
Oh, you mean this particular snippet does not work? If so, that's indeed something that needs fixing.
It doesn’t.
Generates this message jhipster/generator-jhipster#17956 (comment)
@mshima would you be available for a call in the coming days? We can troubleshoot this together.
Sure, please send me an email (marceloshima at gmail dot com).
I've pushed the repository at https://github.com/mshima/neo4j-liquibase.
git clone git@github.com:mshima/neo4j-liquibase.git
cd neo4j-liquibase
npm run docker:db:up
./mvnw
The relevant configuration should be:
https://github.com/mshima/neo4j-liquibase/blob/77c83d17fbbbf121c32838be75bb88069c2197d7/src/main/java/com/mycompany/myapp/config/LiquibaseConfiguration.java#L34-L38
I tried injecting directly, with same result.
Caused by: org.neo4j.driver.exceptions.ClientException: Invalid input 'TABLE': expected "(", "allShortestPaths" or "shortestPath" (line 1, column 8 (offset: 7))
"CREATE TABLE jhi_user (id VARCHAR(255) NOT NULL, login VARCHAR(50) NOT NULL, password_hash VARCHAR(60), first_name VARCHAR(50), last_name VARCHAR(50), email VARCHAR(191), image_url VARCHAR(256), activated BOOLEAN NOT NULL, lang_key VARCHAR(10), activation_key VARCHAR(20), reset_key VARCHAR(20), created_by VARCHAR(50) NOT NULL, created_date timestamp, reset_date timestamp, last_modified_by VARCHAR(50), last_modified_date timestamp, CONSTRAINT PK_JHI_USER PRIMARY KEY (id), CONSTRAINT ux_user_login UNIQUE (login), CONSTRAINT ux_user_email UNIQUE (email))"
^
at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:111)
at org.neo4j.driver.internal.InternalTransaction.run(InternalTransaction.java:58)
at org.neo4j.driver.internal.AbstractQueryRunner.run(AbstractQueryRunner.java:34)
at org.neo4j.driver.internal.AbstractQueryRunner.run(AbstractQueryRunner.java:39)
at liquibase.ext.neo4j.database.jdbc.Neo4jStatement.doExecute(Neo4jStatement.java:656)
at liquibase.ext.neo4j.database.jdbc.Neo4jStatement.execute(Neo4jStatement.java:458)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:441)
... 48 common frames omitted
Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause: null
at org.neo4j.driver.internal.util.ErrorUtil.newNeo4jError(ErrorUtil.java:76)
Let's continue this by email. I managed to get further, we can continue asynchronously.