hazelcast / hazelcast-tomcat-sessionmanager

Tomcat Based Web Session Replication
Other
33 stars 37 forks source link

Hazelcast client for session replication conflicts with webapp #47

Closed stephan2012 closed 5 years ago

stephan2012 commented 6 years ago

At the moment we're running Tomcat 8.5 with built-in session replication. Our webapps include a Hazelcast client for application related caching. This all works without issues.

Now I adjusted the Tomcat config to use Hazelcast as session store and for replication. Unfortunately this seems to conflict with our apps. I already assured that webapp and Tomcat use the same Hazelcast version jars.

This is the Tomcat startup with configured hazelcast-tomcat-sessionmanager:

30-Apr-2018 22:40:22.844 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.30
30-Apr-2018 22:40:22.847 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Apr 3 2018 20:04:09 UTC
30-Apr-2018 22:40:22.847 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.30.0
30-Apr-2018 22:40:22.847 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
30-Apr-2018 22:40:22.847 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-693.17.1.el7.x86_64
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_172-amd64/jre
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_172-b11
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /opt/tomcat
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /opt/tomcat
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
30-Apr-2018 22:40:22.848 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/usr/java/default/jre/lib/ext/jmx_prometheus_javaagent.jar=1234:/etc/jmx_exporter/tomcat.yaml
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xms6g
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xmx6g
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+AlwaysPreTouch
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseConcMarkSweepGC
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+PrintGCDateStamps
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -verbose:gc
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+PrintGCDetails
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Xloggc:/opt/tomcat/logs/gc.log
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:+UseGCLogFileRotation
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:NumberOfGCLogFiles=10
30-Apr-2018 22:40:22.849 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -XX:GCLogFileSize=100M
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DDOMAIN_CONFIG_HOME=/appconfig
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DDOMAIN_CONFIG_LOCATION=/appconfig/config/application/it
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhazelcast.server=hazelcast:5801
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhazelcast.name=dev
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhazelcast.password=dev-pass
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -DmemcachedServerAddresses=webserver:11212
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8453
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dspring.profiles.active=IT,dev
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dlogback.configurationFile=/appconfig/config/application/it/logback.xml
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp
30-Apr-2018 22:40:22.850 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.14] using APR version [1.6.3].
30-Apr-2018 22:40:22.851 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
30-Apr-2018 22:40:22.851 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
30-Apr-2018 22:40:22.856 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2k-fips  26 Jan 2017]
30-Apr-2018 22:40:23.009 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
30-Apr-2018 22:40:23.013 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
30-Apr-2018 22:40:23.019 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
30-Apr-2018 22:40:23.020 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
30-Apr-2018 22:40:23.020 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 633 ms
30-Apr-2018 22:40:23.041 WARNING [main] org.apache.catalina.users.MemoryUserDatabase.createUser Null or zero length user name specified. The user will be ignored.
30-Apr-2018 22:40:23.042 INFO [main] org.apache.tomcat.util.digester.FactoryCreateRule.begin [FactoryCreateRule] Create exception ignored: Null or zero length user name specified. The user will be ignored.
30-Apr-2018 22:40:23.152 WARNING [main] com.hazelcast.config.AbstractXmlConfigHelper.null Name of the hazelcast schema location incorrect using default
30-Apr-2018 22:40:23.246 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
30-Apr-2018 22:40:23.247 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.30
30-Apr-2018 22:40:23.254 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor [/opt/tomcat/conf/Catalina/localhost/manager.xml]
30-Apr-2018 22:40:24.430 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
30-Apr-2018 22:40:24.486 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_0 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is STARTING
30-Apr-2018 22:40:24.856 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_0 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is STARTED
30-Apr-2018 22:40:24.887 INFO [localhost-startStop-1] com.hazelcast.client.spi.impl.ClusterListenerSupport.null hz.client_0 [dev] [3.8.9] Trying to connect to [hz-tomcat-it]:5701 as owner member
30-Apr-2018 22:40:24.973 INFO [hz.client_0.internal-2] com.hazelcast.client.connection.ClientConnectionManager.null hz.client_0 [dev] [3.8.9] Setting ClientConnection{alive=true, connectionId=1, socketChannel=DefaultSocketChannelWrapper{socketChannel=java.nio.channels.SocketChannel[connected local=/172.24.0.4:40092 remote=hz-tomcat-it/172.24.0.3:5701]}, remoteEndpoint=[172.24.0.3]:5701, lastReadTime=2018-04-30 22:40:24.964, lastWriteTime=2018-04-30 22:40:24.961, closedTime=never, lastHeartbeatRequested=never, lastHeartbeatReceived=never, connected server version=3.9.4} as owner  with principal ClientPrincipal{uuid='6456c805-5954-4ff2-bb20-25cb90158acb', ownerUuid='8cb66370-9641-429e-89b8-bb14af094e95'}
30-Apr-2018 22:40:24.973 INFO [hz.client_0.internal-2] com.hazelcast.client.connection.ClientConnectionManager.null hz.client_0 [dev] [3.8.9] Authenticated with server [172.24.0.3]:5701, server version:3.9.4 Local address: /172.24.0.4:40092
30-Apr-2018 22:40:24.978 INFO [hz.client_0.event-2] com.hazelcast.client.spi.impl.ClientMembershipListener.null hz.client_0 [dev] [3.8.9] 

Members [1] {
        Member [172.24.0.3]:5701 - 8cb66370-9641-429e-89b8-bb14af094e95
}

30-Apr-2018 22:40:24.979 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_0 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is CLIENT_CONNECTED
30-Apr-2018 22:40:25.027 INFO [localhost-startStop-1] com.hazelcast.session.HazelcastSessionManager.startInternal contextPath:/manager
30-Apr-2018 22:40:25.036 INFO [localhost-startStop-1] com.hazelcast.session.HazelcastSessionManager.startInternal HazelcastSessionManager started...
30-Apr-2018 22:40:25.059 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor [/opt/tomcat/conf/Catalina/localhost/manager.xml] has finished in [1,804] ms
30-Apr-2018 22:40:25.060 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/webapps/jolokia.war]
30-Apr-2018 22:40:26.120 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
30-Apr-2018 22:40:26.122 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_1 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is STARTING
30-Apr-2018 22:40:26.152 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_1 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is STARTED
30-Apr-2018 22:40:26.162 INFO [localhost-startStop-1] com.hazelcast.client.spi.impl.ClusterListenerSupport.null hz.client_1 [dev] [3.8.9] Trying to connect to [hz-tomcat-it]:5701 as owner member
30-Apr-2018 22:40:26.172 INFO [hz.client_1.internal-2] com.hazelcast.client.connection.ClientConnectionManager.null hz.client_1 [dev] [3.8.9] Setting ClientConnection{alive=true, connectionId=1, socketChannel=DefaultSocketChannelWrapper{socketChannel=java.nio.channels.SocketChannel[connected local=/172.24.0.4:40110 remote=hz-tomcat-it/172.24.0.3:5701]}, remoteEndpoint=[172.24.0.3]:5701, lastReadTime=2018-04-30 22:40:26.171, lastWriteTime=2018-04-30 22:40:26.166, closedTime=never, lastHeartbeatRequested=never, lastHeartbeatReceived=never, connected server version=3.9.4} as owner  with principal ClientPrincipal{uuid='45d420fe-980d-4fa5-a82b-0ee56509eef9', ownerUuid='8cb66370-9641-429e-89b8-bb14af094e95'}
30-Apr-2018 22:40:26.172 INFO [hz.client_1.internal-2] com.hazelcast.client.connection.ClientConnectionManager.null hz.client_1 [dev] [3.8.9] Authenticated with server [172.24.0.3]:5701, server version:3.9.4 Local address: /172.24.0.4:40110
30-Apr-2018 22:40:26.177 INFO [hz.client_1.event-10] com.hazelcast.client.spi.impl.ClientMembershipListener.null hz.client_1 [dev] [3.8.9] 

Members [1] {
        Member [172.24.0.3]:5701 - 8cb66370-9641-429e-89b8-bb14af094e95
}

30-Apr-2018 22:40:26.178 INFO [localhost-startStop-1] com.hazelcast.core.LifecycleService.null hz.client_1 [dev] [3.8.9] HazelcastClient 3.8.9 (20180103 - 1b184fb) is CLIENT_CONNECTED
30-Apr-2018 22:40:26.178 INFO [localhost-startStop-1] com.hazelcast.session.HazelcastSessionManager.startInternal contextPath:/jolokia
30-Apr-2018 22:40:26.184 INFO [localhost-startStop-1] com.hazelcast.session.HazelcastSessionManager.startInternal HazelcastSessionManager started...
30-Apr-2018 22:40:26.384 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/jolokia.war] has finished in [1,324] ms
30-Apr-2018 22:40:26.417 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
30-Apr-2018 22:40:26.475 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
30-Apr-2018 22:40:26.487 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 3466 ms

Deploying the webapp does not succeed anymore with hazelcast-tomcat-sessionmanager:

30-Apr-2018 22:44:50.826 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
30-Apr-2018 22:44:50.836 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
30-Apr-2018 22:44:54.125 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource' defined in class path resource [applicationContext-web-analytics.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [redacted/common/configuration/CommonConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:713)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4776)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5240)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1856)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.annotation.ProxyCachingConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [redacted/common/configuration/CommonConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
        at org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper.findAdvisorBeans(BeanFactoryAdvisorRetrievalHelper.java:92)
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:102)
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:88)
        at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:70)
        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:346)
        at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:298)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:423)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1633)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
        ... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in class path resource [redacted/common/configuration/CommonConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.obtainBeanInstanceFromFactory(ConfigurationClassEnhancer.java:389)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
        at com.redacted.common.configuration.CommonConfiguration$$EnhancerBySpringCGLIB$$e229c9cb.cacheManager(<generated>)
        at org.springframework.cache.annotation.AbstractCachingConfiguration.useCachingConfigurer(AbstractCachingConfiguration.java:84)
        at org.springframework.cache.annotation.AbstractCachingConfiguration.setConfigurers(AbstractCachingConfiguration.java:77)
        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.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:701)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        ... 46 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cache.CacheManager]: Factory method 'cacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 68 more
Caused by: javax.cache.CacheException: Error opening URI [hazelcast]
        at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:97)
        at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:126)
        at com.redacted.common.configuration.CommonConfiguration.cacheManager(CommonConfiguration.java:44)
        at com.redacted.common.configuration.CommonConfiguration$$EnhancerBySpringCGLIB$$e229c9cb.CGLIB$cacheManager$0(<generated>)
        at com.redacted.common.configuration.CommonConfiguration$$EnhancerBySpringCGLIB$$e229c9cb$$FastClassBySpringCGLIB$$e0121c59.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
        at com.redacted.common.configuration.CommonConfiguration$$EnhancerBySpringCGLIB$$e229c9cb.cacheManager(<generated>)
        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.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        ... 69 more
Caused by: com.hazelcast.core.HazelcastException: java.lang.ClassCastException: Cannot cast com.hazelcast.client.impl.DefaultClientExtension to com.hazelcast.client.ClientExtension
        at com.hazelcast.util.ServiceLoader$NewInstanceIterator.next(ServiceLoader.java:331)
        at com.hazelcast.client.impl.HazelcastClientInstanceImpl.createClientInitializer(HazelcastClientInstanceImpl.java:357)
        at com.hazelcast.client.impl.HazelcastClientInstanceImpl.<init>(HazelcastClientInstanceImpl.java:209)
        at com.hazelcast.client.HazelcastClient$1.createHazelcastInstanceClient(HazelcastClient.java:55)
        at com.hazelcast.client.HazelcastClientManager.newHazelcastClient(HazelcastClientManager.java:74)
        at com.hazelcast.client.HazelcastClientManager.newHazelcastClient(HazelcastClientManager.java:60)
        at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:68)
        at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.getInstanceThroughDefaultInstanceIfItIsDefault(HazelcastClientCachingProvider.java:119)
        at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.getOrCreateInstance(HazelcastClientCachingProvider.java:109)
        at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createHazelcastCacheManager(HazelcastClientCachingProvider.java:56)
        at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createHazelcastCacheManager(HazelcastClientCachingProvider.java:36)
        at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:94)
        ... 81 more
Caused by: java.lang.ClassCastException: Cannot cast com.hazelcast.client.impl.DefaultClientExtension to com.hazelcast.client.ClientExtension
        at java.lang.Class.cast(Class.java:3369)
        at com.hazelcast.util.ServiceLoader$NewInstanceIterator.next(ServiceLoader.java:329)
        ... 92 more

30-Apr-2018 22:44:54.190 INFO [localhost-startStop-2] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

Looks like there currently is no way of isolating the Hazelcast client for the Tomcat session manager from the app’s client.

stephan2012 commented 6 years ago

Hazelcast client config for hazelcast-tomcat-sessionmanager:

<?xml version="1.0" encoding="UTF-8"?>
<hazelcast-client xmlns="http://www.hazelcast.com/schema/client-config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/client-config hazelcast-client-config-3.9.xsd">
  <network>
    <cluster-members>
      <address>hz-tomcat:5701</address>
    </cluster-members>
  </network>
</hazelcast-client>
gokhanoner commented 5 years ago

@stephan2012 do you want to use the same client for both session or application or different? Also, can you confirm if your application is a Spring or Spring-Boot application & share the Hazelcast Client bean config?

stephan2012 commented 5 years ago

@gokhanoner: Preferably the client is different for session and application management because session replication is handled by ops team while application data is handled by developers. Indeed, it is a Spring application.

Unfortunately I cannot contribute anything anymore to this issue because I have left the team and company in Summer, 2018. In case it does not make sense to continue on this issue please feel free to close it.

alparslanavci commented 5 years ago

@stephan2012 I tried to reproduce your issue, but couldn't manage it. It might be helpful if we have the Hazelcast client version and configuration on application caching side. But you stated you left the team, then I am closing this issue.