Pivotal Knowledge Base

Follow

TC Server Error GemFire Manager Error: "com.gemstone.gemfire.ToDataException"

Environment

 Product  Version
 TC Server  3.1.x, 3.2.x
 GemFire  8.2.0.14

Overview

This article provides a troubleshooting guide when you are using the Gemfire template and when trying to create a HTTP session and a ToDataException is thrown.

Symptom

Checking into the TC server's log, it contains the error below:

HTTP Status 500 - com.gemstone.gemfire.ToDataException: toData failed on DataSerializable class com.gemstone.gemfire.modules.session.catalina.DeltaSession
type Exception report
message com.gemstone.gemfire.ToDataException: toData failed on DataSerializable class com.gemstone.gemfire.modules.session.catalina.DeltaSession
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: com.gemstone.gemfire.ToDataException: toData failed on DataSerializable class com.gemstone.gemfire.modules.session.catalina.DeltaSession 
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:561)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
com.gemstone.gemfire.ToDataException: toData failed on DataSerializable class com.gemstone.gemfire.modules.session.catalina.DeltaSession 
com.gemstone.gemfire.internal.InternalDataSerializer.invokeToData(InternalDataSerializer.java:2436)
com.gemstone.gemfire.internal.InternalDataSerializer.basicWriteObject(InternalDataSerializer.java:2196)
com.gemstone.gemfire.DataSerializer.writeObject(DataSerializer.java:3179)
com.gemstone.gemfire.internal.util.BlobHelper.serializeTo(BlobHelper.java:65)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.serializeAndAddPart(Message.java:359)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.addObjPart(Message.java:341)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.addObjPart(Message.java:333)
com.gemstone.gemfire.cache.client.internal.PutOp$PutOpImpl.<init>(PutOp.java:290)
com.gemstone.gemfire.cache.client.internal.PutOp.execute(PutOp.java:67)
com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.put(ServerRegionProxy.java:196)
com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(LocalRegion.java:3002)
com.gemstone.gemfire.internal.cache.LocalRegion.cacheWriteBeforePut(LocalRegion.java:3138)
com.gemstone.gemfire.internal.cache.AbstractRegionMap.invokeCacheWriter(AbstractRegionMap.java:3215)
com.gemstone.gemfire.internal.cache.AbstractRegionMap.basicPut(AbstractRegionMap.java:2979)
com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5821)
com.gemstone.gemfire.internal.cache.LocalRegionDataView.putEntry(LocalRegionDataView.java:118)
com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(LocalRegion.java:5211)
com.gemstone.gemfire.internal.cache.LocalRegion.validatedPut(LocalRegion.java:1597)
com.gemstone.gemfire.internal.cache.LocalRegion.put(LocalRegion.java:1580)
com.gemstone.gemfire.internal.cache.AbstractRegion.put(AbstractRegion.java:327)
com.gemstone.gemfire.modules.session.catalina.AbstractSessionCache.putSession(AbstractSessionCache.java:54)
com.gemstone.gemfire.modules.session.catalina.DeltaSessionManager.add(DeltaSessionManager.java:417)
org.apache.catalina.session.StandardSession.setId(StandardSession.java:386)
org.apache.catalina.session.StandardSession.setId(StandardSession.java:370)
org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:777)
org.apache.catalina.connector.Request.doGetSession(Request.java:3103)
org.apache.catalina.connector.Request.getSession(Request.java:2430)
org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
org.apache.jsp.session_jsp._jspService(session_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
root cause
java.lang.NoSuchFieldError: attributes 
com.gemstone.gemfire.modules.session.catalina.DeltaSession.getSerializedAttributes(DeltaSession.java:557)
com.gemstone.gemfire.modules.session.catalina.DeltaSession.toData(DeltaSession.java:496)
com.gemstone.gemfire.internal.InternalDataSerializer.invokeToData(InternalDataSerializer.java:2404)
com.gemstone.gemfire.internal.InternalDataSerializer.basicWriteObject(InternalDataSerializer.java:2196)
com.gemstone.gemfire.DataSerializer.writeObject(DataSerializer.java:3179)
com.gemstone.gemfire.internal.util.BlobHelper.serializeTo(BlobHelper.java:65)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.serializeAndAddPart(Message.java:359)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.addObjPart(Message.java:341)
com.gemstone.gemfire.internal.cache.tier.sockets.Message.addObjPart(Message.java:333)
com.gemstone.gemfire.cache.client.internal.PutOp$PutOpImpl.<init>(PutOp.java:290)
com.gemstone.gemfire.cache.client.internal.PutOp.execute(PutOp.java:67)
com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.put(ServerRegionProxy.java:196)
com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(LocalRegion.java:3002)
com.gemstone.gemfire.internal.cache.LocalRegion.cacheWriteBeforePut(LocalRegion.java:3138)
com.gemstone.gemfire.internal.cache.AbstractRegionMap.invokeCacheWriter(AbstractRegionMap.java:3215)
com.gemstone.gemfire.internal.cache.AbstractRegionMap.basicPut(AbstractRegionMap.java:2979)
com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5821)
com.gemstone.gemfire.internal.cache.LocalRegionDataView.putEntry(LocalRegionDataView.java:118)
com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(LocalRegion.java:5211)
com.gemstone.gemfire.internal.cache.LocalRegion.validatedPut(LocalRegion.java:1597)
com.gemstone.gemfire.internal.cache.LocalRegion.put(LocalRegion.java:1580)
com.gemstone.gemfire.internal.cache.AbstractRegion.put(AbstractRegion.java:327)
com.gemstone.gemfire.modules.session.catalina.AbstractSessionCache.putSession(AbstractSessionCache.java:54)
com.gemstone.gemfire.modules.session.catalina.DeltaSessionManager.add(DeltaSessionManager.java:417)
org.apache.catalina.session.StandardSession.setId(StandardSession.java:386)
org.apache.catalina.session.StandardSession.setId(StandardSession.java:370)
org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:777)
org.apache.catalina.connector.Request.doGetSession(Request.java:3103)
org.apache.catalina.connector.Request.getSession(Request.java:2430)
org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:897)
org.apache.jsp.session_jsp._jspService(session_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Pivotal tc Runtime 3.2.2.RELEASE/7.0.72.B.RELEASE logs.
Pivotal tc Runtime 3.2.2.RELEASE/7.0.72.B.RELEASE

Cause 

Java app is throwing the NoSuchFieldError error because the DeltaSession child class was originally compiled against a StandardSession class that defined attributes as a Map and it is not able to access the field as the more specific ConcurrentMap. This error is caused when using the TC server version above with a Gemfire template that is compiled against Gemfire modules 8.2.1.2.

Resolution

The solution requires both updating the Gemfire Session Manager on the TC server and the classpath on the Gemfire server. Here are step to resolve this error:

TC Server

1. Download the GemFire HTTP Session Manager with the GemFire client update to 8.2.2.
2. Install the downloaded template using the procedure here.
3. Either create an instance with the Gemfire template or Apply the template to your existing instance.  

GemFire Server

Add the following jars to your classpath due to a change in tomcat between 7.0.62 and 7.0.70:

  • $GEMFIRE_MODULES/gemfire-cs/lib/gemfire-modules-8.2.2.jar
  • $GEMFIRE_MODULES/gemfire-cs/lib/gemfire-modules-tomcat7-8.2.2.jar

Gemfire needs these deployed on the server side to deserialize the relevant classes and utilize the appropriate functions, just as with any client classes and functions. Note that installing the 8.2.2 modules in the client requires the 8.2.2 module jars to be deployed on the server.

Although the Gemfire modules are shipped with Gemfire, it is best to think of them as a separate client app and not a Gemfire component. Hence, the relevant domain classes and function classes need to be deployed (via the jars) as with any client application.

Additional Information

Using TC Server Templates

Comments

Powered by Zendesk