Connect Spring Boot 2.4.x to neo4j-3.4.x - spring-boot

I'm trying to connect a Spring Boot 2.4.6 service to a Neo4j 3.4.18-enterprise server, but I get the following error:
Caused by: org.neo4j.driver.exceptions.ClientException: The server does not support any of the protocol versions supported by this driver. Ensure that you are using driver and server versions that are compatible with one another.
at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:143)
at org.neo4j.driver.internal.InternalSession.run(InternalSession.java:69)
at org.neo4j.driver.internal.InternalSession.run(InternalSession.java:51)
at org.neo4j.driver.internal.AbstractQueryRunner.run(AbstractQueryRunner.java:37)
at org.neo4j.driver.internal.AbstractQueryRunner.run(AbstractQueryRunner.java:43)
... 99 more
Reading this compatibility matrix I'm assuming (or rather I'm hoping) there should be a way to make Spring Boot 2.4.x work with Neo4j 3.4.x
Here's a docker command to start a neo4j server:
docker run --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data --env=NEO4J_ACCEPT_LICENSE_AGREEMENT=yes --env=NEO4J_AUTH=neo4j/test neo4j:3.4-enterprise
And here's a github repository with a simple test to reproduce the issue:
#SpringBootTest
class SpringBootNeo4jCompatibilityTestApplicationTests {
#Autowired
private Neo4jClient neo4jClient;
#Test
void testNeo4jConnection_whenQueryIsRun_thenNoExceptionShouldBeThrown() {
neo4jClient.query("MATCH (n) RETURN n")
.run();
}
}
The test fails when ran against neo4j 3.4.x, but it passes when ran against neo4j 3.5.6-enterprise.
Could you please suggest a way to make this connection work?
Thank you.

Neo4j 3.4 is not maintained anymore, upgrade at least to 3.5: https://neo4j.com/developer/kb/neo4j-supported-versions/

Related

Spring Boot vs JOOQ vs Unix socket

I have Spring boot app with JOOQ for working with PostrgesDB.
This app must be running on Google cloud. If I deploy this as AppEngine Flex all works without problem.
Now I need deploy and run this app into the google run. Way for connect Cloud Run with PostgresDB is described https://cloud.google.com/sql/docs/postgres/connect-run#public-ip-default_1.
My problem is in combination using of JOOQ and com.google.cloud.sql.postgres.SocketFactory
Do you have some solution?
jOOQ offers means of executing queries via JDBC, and starting from jOOQ 3.15 via R2DBC. If your installation doesn't support a JDBC or R2DBC driver but requires more low level interaction, you can't use jOOQ to execute SQL directly, but you can still extract your SQL strings and bind variables from jOOQ queries and implement the glue code to your SocketFactory yourself. An example is provided here where jOOQ queries are executed on a JPA EntityManager:
// query is any jOOQ query
String sql = query.getSQL();
List<Object> binds = query.getBindValues();

Spring-jdbc 5.0.5 NamedParameterJdbcTemplate.batchUpdate ORA-01000

After migrating from Spring 4.1.7 to Spring 5.0.5 we have ORA-01000: maximum open cursors exceeded when using with Oracle 12c and ojdbc7 driver
Exception raised after following code
#SuppressWarnings("unchecked")
private void executeBatch(Map<String, Object>[] updateBatchParams) {
int[] updateResults = namedJdbcTemplate.batchUpdate(SQL, updateBatchParams);
The issue is very similar to https://jira.spring.io/browse/SPR-16139.
But we dont have ability to update ojdbc driver.
Any ideas how the issue can be fixed?
P.S. Created an issue in Spring jira
Juergen Hoeller:
There hasn't been any recent work on this. Since this is effectively
a bug in the Oracle JDBC driver, I'm afraid we won't be introducing a
workaround for an older driver at this point.
You could try setting spring.jdbc.getParameterType.ignore=true as a
system property on in a spring.properties file in the root of your
classpath, or use spring-jdbc-4.3.17 for the time being... with all
other jars set to 5.0.6 (which isn't officially supported but should
work fine in practice). I strongly recommend upgrading the JDBC driver
though.

#EnableTask annotation does not support DB2 on Mainframe on DB2ZOS

We had a problem statement to convert a Mainframe DB2 long running job to convert to Spring Cloud Task.
It was working fine as a Spring Boot Ap, but when we tried to convert it to Spring cloud task as mentioned in
https://cloud.spring.io/spring-cloud-task/
We got an exception saying DB2ZOS not found.
Please help.
Note:When we changed to MongoDB for a POC,it worked fine.
Thanks for reporting this. I have created an issue to track this here: https://github.com/spring-cloud/spring-cloud-task/issues/303

WebLogic ModuleException on Hibernate Dialect

The database group recently upgraded the database to Oracle12c. I am currently using Hibernate 4.3.9. When I try to deploy the application, WebLogic throws an exception:
weblogic.application.ModuleException: org.hibernate.HibernateException: Unable to determine dialect to use [name=Oracle, majorVersion=12]; user must register resolver or explicitly set 'hibernate.dialect'.
HibernateUtil has
props.setProperty("hibernate.dialect", "utilities.OracleDialectExtended");
Where OracleDialectExtended extends Oracle10gDialect in order to register a Double as a float. HibernateUtil is being used to set the properties rather than in hibernate.cfg.xml.
Everything I have read indicates that using Oracle10gDialect should be OK. In fact, when I use the same set up in a batch type mode (not using WebLogic) I am able to connect with and work with Oracle without a problem.
Does anyone know how to resolve this? Or is this a WebLogic problem that needs to be addressed by a WebLogic admin.
Thanks.
Try with this:
props.setProperty("hibernate.dialect","org.hibernate.dialect.OracleDialect");
Just to follow up - in the end I upgraded Hibernate from 4.3.9 to 5.1.2 and things started working again.
Not the most ideal solution since a database upgrade shouldn't break an application but it was the fastest way to get things up and running again.

AbstractMethodError When using Jboss5 and Hibernate 4

I am trying to Upgrade my Spring 1.9 Application to Spring 4 and therefore I also have to upgrade Hibernate. As database I am using Oracle.
When starting the application everything is fine until I am using Clobs, then the following Exception is thrown:
java.lang.AbstractMethodError:org.jboss.resource.adapter.jdbc.jdk5.WrappedPreparedStatementJDK5.setCharacterStream(ILjava/io/Reader;J)V
I also already upgradet my JDBC driver, does anyone have hint, what else to try?
The problem is the jboss-common-jdbc-wrapper.jar located under ${JBOSS_HOME}\common\lib obviously it was implemented against an Interface which was created in a version which is less then JDK_1.6. Therefore the method was never implemented though.
After replacing this Jar, with the same vom a JBoss AS 6.1 everything is working fine.
BR

Resources