The Ignite thick client provides a method to set the class loader. I have successfully used this to avoid class not found exception when removing values from Ignite Caches. Otherwise I get conflicts with the class loader from my tomcat application. See example below:
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setClassLoader(MyClass.class.getClassLoader());
Ignite ig = Ignition.start(cfg);
IgniteCache<Integer,MyClass> myCache = ig.getOrCreateCache("MyClass");
MyClass mc = myCache.get( 0 ); //throws java.lang.ClassNotFoundException without line 2
I am now trying to use a thin client which does not provide this method. Is there away way to configure the class loader for the thin client? Or is there some other way to avoid class not found exceptions when attempting to deserialize objects when removing them from the Ignite ClientCache?
ClientConfiguration cfg = new ClientConfiguration();
ClientIgnite ig = Ignition.startClient(cfg);
ClientCache<Integer,MyClass> myCache = ig.getOrCreateCache("MyClass");
MyClass mc = myCache.get( 0 ); //throws java.lang.ClassNotFoundException
After mulling this over I decided to try and solve this from the tomcat side rather than ignite. Below are the links helped me better understand this problem.
In the end the issue was that the ignite classes were loaded by a class loader that was a parent to my web applications class loader.
In the end I just added the ignite jars to WEB-INF/lib and then the ignite classes would be loaded by the webapp class loader, solving the whole problem.
https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html https://www.mulesoft.com/tcat/tomcat-classpath