Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignite 2.16 is incompatible with recent h2database, h2 must be shaded #11333

Open
magicprinc opened this issue Apr 28, 2024 · 2 comments
Open

Comments

@magicprinc
Copy link

magicprinc commented Apr 28, 2024

With com.h2database:h2:2.2.224 I receive:

java.lang.NoClassDefFoundError: org/h2/value/ValueByte

	at org.apache.ignite.internal.processors.query.h2.twostep.msg.GridH2ValueMessageFactory.registerAll(GridH2ValueMessageFactory.java:40)
	at org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl.<init>(IgniteMessageFactoryImpl.java:72)
	at org.apache.ignite.internal.managers.communication.GridIoManager.start(GridIoManager.java:482)
	at org.apache.ignite.internal.IgniteKernal.startManager(IgniteKernal.java:1774)
	at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1008)
	at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1725)
	at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1647)
	at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1089)
	at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:625)
	at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:547)
	at org.apache.ignite.Ignition.start(Ignition.java:300)
	at ignite.ExpireTest.expireListener(ExpireTest.java:32)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.ClassNotFoundException: org.h2.value.ValueByte
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	... 15 more

The last compatible version of h2 is 1.4.197 → Mar 18, 2018
with a lot of vulnerabilities!

The h2 database must be either:

  • upgraded (better)
  • or shaded

I use Gradle and don't know Maven, but it should probably look close to this:

magicprinc@a185f1e

(see also #9336)

See also
https://github.com/gridgain/gridgain/tree/master/modules/h2

@magicprinc magicprinc changed the title Ignite 2.16 is incompatible with recent h2database Ignite 2.16 is incompatible with recent h2database, h2 must be shaded May 4, 2024
@nao-it
Copy link
Contributor

nao-it commented May 6, 2024

@magicprinc
New versions of the h2 engine will not work with Apache Ignite, you can use the Calcite engine if these vulnerabilities are critical for you https://ignite.apache.org/docs/latest/SQL/sql-calcite#calcite-module-libraries

@magicprinc
Copy link
Author

magicprinc commented May 6, 2024

@nao-it No, I have another problem. I use some library, which depends on new h2. So, thers is a conflict between new h2 and Ignite's h2. The good solution is shading. GridGain Community has shaded h2 ⇒ no public dependency, all classes bundled with different package name.

More theory on the topic "shading" (maven plugin is also available)
https://imperceptiblethoughts.com/shadow/introduction/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants