Open manish-in-java opened 3 years ago
Ok, here is what I have found.
With both hazelcast-all-4.1.jar
and cache-api-1.1.1.jar
in $TOMCAT_HOME/lib
, if I delete the file META-INF/services/javax.cache.spi.CachingProvider
from hazelcast-all-4.1.jar
, Tomcat starts fine.
This seems like a classloader problem.
Is it possible to use Tomcat Session Manager with a JAR that does not contain the file javax.cache.spi.CachingProvider
?
Same problem occurs here with Hazelcast 3.7.8 as (Hibernate) JCache provider and cache-api-1.1.1.jar, both within the application WEB-INF/lib dir. Tomcat 8.5.35 lib dir contains only the default Tomcat provided libraries plus mariadb-java-client-2.4.4.jar Java 8.
java.lang.ClassNotFoundException: javax.cache.CacheException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1328)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1156)
at com.hazelcast.cache.impl.CacheDataSerializerHook$25.createNew(CacheDataSerializerHook.java:250)
at com.hazelcast.cache.impl.CacheDataSerializerHook$25.createNew(CacheDataSerializerHook.java:248)
at com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory.create(ArrayDataSerializableFactory.java:42)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.readInternal(DataSerializableSerializer.java:139)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:104)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:54)
at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48)
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:172)
at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:307)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:381)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:117)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:102)
Wrapped by: java.lang.NoClassDefFoundError: javax/cache/CacheException
at com.hazelcast.cache.impl.CacheDataSerializerHook$25.createNew(CacheDataSerializerHook.java:250)
at com.hazelcast.cache.impl.CacheDataSerializerHook$25.createNew(CacheDataSerializerHook.java:248)
at com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory.create(ArrayDataSerializableFactory.java:42)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.readInternal(DataSerializableSerializer.java:139)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:104)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.read(DataSerializableSerializer.java:54)
at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48)
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:172)
at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:307)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:381)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:117)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:102)
at ------ submitted from ------.(Unknown Source)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolve(InvocationFuture.java:111)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveAndThrow(InvocationFuture.java:74)
at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:158)
at com.hazelcast.spi.impl.AbstractInvocationFuture.join(AbstractInvocationFuture.java:134)
at com.hazelcast.cache.impl.HazelcastServerCacheManager.getCacheConfig(HazelcastServerCacheManager.java:196)
at com.hazelcast.cache.impl.HazelcastServerCacheManager.findCacheConfig(HazelcastServerCacheManager.java:146)
at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCacheUnchecked(AbstractHazelcastCacheManager.java:244)
at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCache(AbstractHazelcastCacheManager.java:218)
at com.hazelcast.cache.impl.AbstractHazelcastCacheManager.getCache(AbstractHazelcastCacheManager.java:66)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.getOrCreateCache(JCacheRegionFactory.java:97)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.createDomainDataStorageAccess(JCacheRegionFactory.java:83)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.buildDomainDataRegion(JCacheRegionFactory.java:72)
at org.hibernate.cache.internal.EnabledCaching.prime(EnabledCaching.java:113)
at org.hibernate.metamodel.internal.MetamodelImpl.primeSecondLevelCacheRegions(MetamodelImpl.java:331)
at org.hibernate.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:160)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:301)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:469)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:287)
I have the same problem as well..
Ok, here is what I have found.
With both
hazelcast-all-4.1.jar
andcache-api-1.1.1.jar
in$TOMCAT_HOME/lib
, if I delete the fileMETA-INF/services/javax.cache.spi.CachingProvider
fromhazelcast-all-4.1.jar
, Tomcat starts fine.This seems like a classloader problem.
Is it possible to use Tomcat Session Manager with a JAR that does not contain the file
javax.cache.spi.CachingProvider
?
@manish-in-java how were you resolve this ?
Describe the problem
cache-api.jar
Expected result
Tomcat should start successfully.
Actual result
Tomcat does not start. The following error stacktrace is seen:
Any help in how to overcome this error will be greatly appreciated.
Additional context
I do not have control over the WAR files and their content, so it will be useful to have a solution that involves changes only to Tomcat configuration.