Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
D'oh, I ran the tests with version 1.4.199 the first time, they're still failing with 2.2.224, but I'm getting another error now (column names that are reserved words). I can probably fix that. Anyway, thanks for your help. On Wed, Oct 25, 2023 at 3:45 PM Knut Skomedal wrote: > > Thanks, changin

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
Thanks, changing the user in the JdbcDataSource definition solved the problem. My tests are now running. With regards, Knut On Wed, Oct 25, 2023 at 3:10 PM Noel Grandin wrote: > > I think it's because you are using a username of "PUBLIC", which conflicts > with something we have changed (not

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Noel Grandin
I think it's because you are using a username of "PUBLIC", which conflicts with something we have changed (not sure what). "PUBLIC" is the name of the default schema and the default role, so it is no surprise that it conflicts. Probably we should be throwing a better error message in that case

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
When I'm running 1.4.199 the execution ends in the same method for addDatabaseObject(Session session, DbObject obj) which seems unchanged with a casual glance. session = {Session} "#0 (user: DBA)" serialId = 0 database = {Database} "SVIFT:org.h2.engine.Database" connectionInfo = null user =

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
I've debugged the last part of the process where hibernate tries to get a connection to the database, starting with a breakpoint in org.h2.engine.Engine.createSession(Engine.java:201) public static SessionLocal createSession(ConnectionInfo ci) { try { SessionLocal sessio

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
The same Exception occurs when I run a single test manually in intelliJ, so I doubt that it's a race condition between two tests. By setting a breakpoint where the previous stacktrace has the last statement: Caused by: java.lang.RuntimeException: object already exists at org.h2.message.DbE

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Noel Grandin
My best guess right now is that you are using named in-memory databases, which means that the unit tests are sharing an in-memory database, and you are hitting a race condition (TOCTOU) in that chunk of code. Short of fixing the H2 code, the only thing I can suggest is using different databases

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
In addition, the h2 database is initialized by running scripts that fits the chosen profile of the project. <-- it's set to ignore failures from dropping the tables, maybe this no longer works as before? On Wed, Oct 25, 2023 at 8:59 AM Knut Skomedal wrote: > > Here's the full

Re: [h2] Java junit tests fails with "object already exists" after upgrade from h2 1.4.199 to 2.2.224

2023-10-25 Thread Knut Skomedal
Here's the full stacktrace: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.support.D