[Axon Server migration] Exception when starting the migration processs : Large Objects may not be used in auto-commit mode.

Hello,

I just downloaded the axonserver-migration JAR via the URL provided by Marc, but I’m not able to make it work against my current event store in PostgreSQL 9.6.

First, the JDBC driver is not included in this JAR meaning that you need to include it in the classpath at runtime as following (assuming you have the postgresql JDBC driver in the same folder as the JAR).

`
java -cp axonserver-migration.jar -Dloader.path=. org.springframework.boot.loader.PropertiesLauncher

`

So far, so good, no error about that anymore. Then the migration process starts and we get another error:

`
Caused by: org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:249) ~[postgresql-42.2.8.jar!/:42.2.8]
at org.postgresql.largeobject.LargeObjectManager.open(LargeObjectManager.java:235) ~[postgresql-42.2.8.jar!/:42.2.8]
at org.postgresql.jdbc.AbstractBlobClob.getLo(AbstractBlobClob.java:269) ~[postgresql-42.2.8.jar!/:42.2.8]
at org.postgresql.jdbc.AbstractBlobClob.getBinaryStream(AbstractBlobClob.java:114) ~[postgresql-42.2.8.jar!/:42.2.8]
at org.hibernate.type.descriptor.java.PrimitiveByteArrayTypeDescriptor.wrap(PrimitiveByteArrayTypeDescriptor.java:120) ~[hibernate-core-5.3.10.Final.jar!/:5.3.10.Final]
… 49 common frames omitted

`

So I legitimately tried to disable the auto commit at Hikari and Hibernate level by setting the current properties:

spring.jpa.properties.hibernate.connection.provider_disables_autocommit=true spring.datasource.hikari.auto-commit=falseSaisissez le code ici...

Unfortunately, same result, it’s like these properties are not taken into account or overriden by some other configuration. I’m not sure how to investigate further as we don’t have access to the sources of this migration tool.

Thank you for your help,
B.R
Jerome

Hi Jerome,

There is indeed a problem with the migration tool that you downloaded when using it to read events from postgresql, as this database has a slightly specific way of handling LOBs.

I have created a new version of the migration tool, that works with PostgreSQL. You can download it using the same link.
If you put the postgresql jar file in a libs directory you can start the tool without any additional options (jar files in the libs directory are automatically included in the classpath).

In my application properties I added the line:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

to avoid an exception on startup of the tool.

I hope this solves your issue.

Regards,
Marc

Thank you Marc ! I’ll test and let you know.

Best Regards,
Jerome