问题
I have integrate latest ignite for cache and web session clustering ...while session caching i got an error
- Failed to update web session: null
org.apache.jasper.JasperException: class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteCheckedException: com.bizmatics.prognocis.view.MenuHistoryView
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:604)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:514)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.ignite.cache.websession.WebSessionFilter.doFilterV2(WebSessionFilter.java:562)
at org.apache.ignite.cache.websession.WebSessionFilter.doFilterDispatch(WebSessionFilter.java:407)
at org.apache.ignite.cache.websession.WebSessionFilter.doFilter(WebSessionFilter.java:383)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.bizmatics.common.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:169)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:394)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: class org.apache.ignite.IgniteException: class org.apache.ignite.IgniteCheckedException: com.bizmatics.prognocis.view.MenuHistoryView
at org.apache.ignite.cache.websession.WebSessionV2.getAttribute(WebSessionV2.java:209)
at org.apache.jsp.scrBannMenu_jsp._jspService(scrBannMenu_jsp.java:1362)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
... 33 more
Caused by: java.io.IOException: class org.apache.ignite.IgniteCheckedException: com.bizmatics.prognocis.view.MenuHistoryView
at org.apache.ignite.cache.websession.WebSessionV2.unmarshal(WebSessionV2.java:345)
at org.apache.ignite.cache.websession.WebSessionV2.getAttribute(WebSessionV2.java:206)
... 37 more
Caused by: class org.apache.ignite.IgniteCheckedException: com.bizmatics.prognocis.view.MenuHistoryView
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:10174)
at org.apache.ignite.cache.websession.WebSessionV2.unmarshal(WebSessionV2.java:342)
... 38 more
Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: com.bizmatics.prognocis.view.MenuHistoryView
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:707)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1758)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1717)
at org.apache.ignite.internal.binary.BinaryUtils.doReadObject(BinaryUtils.java:1778)
at org.apache.ignite.internal.binary.BinaryUtils.deserializeOrUnmarshal(BinaryUtils.java:2141)
at org.apache.ignite.internal.binary.BinaryUtils.doReadCollection(BinaryUtils.java:2072)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1917)
at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1717)
at org.apache.ignite.internal.binary.GridBinaryMarshaller.deserialize(GridBinaryMarshaller.java:313)
at org.apache.ignite.internal.binary.BinaryMarshaller.unmarshal0(BinaryMarshaller.java:102)
at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshaller.java:82)
at org.apache.ignite.internal.util.IgniteUtils.unmarshal(IgniteUtils.java:10168)
... 39 more
Caused by: java.lang.ClassNotFoundException: com.bizmatics.prognocis.view.MenuHistoryView
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:374)
at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8775)
at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:349)
at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:698)
... 50 more
Client Configuration
Web.xml
<listener>
<listener-class>org.apache.ignite.startup.servlet.ServletContextListenerStartup</listener-class>
</listener>
<filter>
<filter-name>IgniteWebSessionsFilter</filter-name>
<filter-class>org.apache.ignite.cache.websession.WebSessionFilter</filter-class>
</filter>
<!-- You can also specify a custom URL pattern. -->
<filter-mapping>
<filter-name>IgniteWebSessionsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Specify Ignite configuration (relative to META-INF folder or Ignite_HOME). -->
<context-param>
<param-name>IgniteConfigurationFilePath</param-name>
<param-value>../WEB-INF/default-config.xml</param-value>
</context-param>
<!-- Specify the name of Ignite cach`e for web sessions. -->
<context-param>
<param-name>IgniteWebSessionsCacheName</param-name>
<param-value>session-cache</param-value>
</context-param>
default-config.xml
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="clientMode" value="true"/>
<property name="peerClassLoadingEnabled" value="true"/>
<!--<property name="marshaller">
<bean class="org.apache.ignite.marshaller.jdk.JdkMarshaller"/>
</property>-->
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<value>10.2.0.224:47500..47509</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
<property name="cacheConfiguration">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="session-cache"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="onheapCacheEnabled" value="true"/>
<property name="evictionPolicy">
<!-- LRU eviction policy. -->
<bean class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
<!-- Set the maximum cache size to 1 million (default is 100,000). -->
<property name="maxSize" value="1000000"/>
</bean>
</property>
</bean>
</property>
</bean>
Java Source :
IgniteConfiguration igniteCfg = new IgniteConfiguration()
.setCacheConfiguration(new CacheConfiguration<String, String>()
.setCacheMode(CacheMode.PARTITIONED)
.setOnheapCacheEnabled(true)
.setAtomicityMode(CacheAtomicityMode.ATOMIC)
.setName("Cache")
.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, asTimeout)))
).setClientMode(true)
.setMetricsLogFrequency(0).setPeerClassLoadingEnabled(true);
DataStorageConfiguration storageCfg = new DataStorageConfiguration();
storageCfg.getDefaultDataRegionConfiguration().setInitialSize(512L * 1024 * 1024).setMaxSize(2L * 1024 * 1024 * 1024);
igniteCfg.setDataStorageConfiguration(storageCfg);
Ignite ignite = Ignition.getOrStart(igniteCfg);
Cache = ignite.getOrCreateCache("Cache")
;
Server Configuration :
default-xml :
bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="workDirectory" value="D:/apache-ignite-2.7.6-bin/work" />
<property name="peerClassLoadingEnabled" value="true"/>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name="addresses">
<list>
<value>10.2.0.224:47500..47509</value>
<!--<value>10.2.1.11:47500..47509</value>
<value>10.10.17.3:47500..47509</value>-->
</list>
</property>
</bean>
</property>
</bean>
</property>
<!-- Redefining maximum memory size for the cluster node usage. -->
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<!-- Redefining the default region's settings -->
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="name" value="Default_Region"/>
<!-- Setting the size of the default region to 2GB. -->
<property name="maxSize" value="#{2L * 1024 * 1024 * 1024}"/>
<property name="persistenceEnabled" value="false"/>
</bean>
</property>
</bean>
</property>
<!-- The rest of the parameters. -->
</bean>
MenuHistoryView is a class which implements Serializable and has been store in arraylist and arraylist has been store in session
I have also try changing default binary marshaller to optimized marshaller and jdk marshaller but not able to get the fix
来源:https://stackoverflow.com/questions/59490461/ignite-web-session-clustering-class-not-found-exception