Search code examples
javaspring-booth2ignite

java.lang.ClassNotFoundException: org.h2.index.BaseIndex


I had updated the version of H2 Database Engine from 1.4.195 to 2.1.210. Now when I try to run the spring boot application I'm getting error.

Caused by: java.lang.NoClassDefFoundError: org/h2/index/BaseIndex
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.apache.ignite.internal.util.IgniteUtils.inClassPath(IgniteUtils.java:1727)
    at org.apache.ignite.internal.IgniteComponentType.inClassPath(IgniteComponentType.java:160)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.initializeDefaultSpi(IgnitionEx.java:2480)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.initializeConfiguration(IgnitionEx.java:2328)
    at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1697)
    at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1117)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:637)
    at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:563)
    at org.apache.ignite.Ignition.start(Ignition.java:321)
    at com.x.y.z.cache.ignite.IgniteCacheProviderWithExpiry.init(IgniteCacheProviderWithExpiry.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157)
    ... 60 more

Please help me in solving the issue.


Solution

  • Apache Ignite uses unsupported internal classes of H2 Database instead of own code or some proper third-party library, they aren't a part of API and can be modified in any way in every release of H2. You can find the required version in pom.xml of ignite-core. For Apache Ignite 2.12.0 it is H2 1.4.197: https://repo1.maven.org/maven2/org/apache/ignite/ignite-core/2.12.0/ignite-core-2.12.0.pom and this version is unlikely to be updated, Ignite / GridGain and H2 parted the ways a long time ago.

    Apache Ignite project has some plans to use Apache Calcite as SQL engine in future versions of Apache Ignite: https://cwiki.apache.org/confluence/display/IGNITE/Apache+Calcite-powered+SQL+Engine+Roadmap