Expand deserialization context to provide Injector object instead of just a DataChannel.

Details

Description

Replace BaseContext.bindThreadDeserializationChannel/getThreadDeserializationChannel with a more generic context for deserialization : CayenneRuntime.bindThreadInjector/getThreadInjector. This way deserialized objects can lookup any service in the runtime container. Will need to test that in real scenarios (e.g. deserializing sessions from disk in Tomcat)

Activity

Issues with Tomcat 7.0.8 deserialization. Given a web app similar to Cayenne web tutorial with a session containing a DataContext with one object. When Tomcat is shutdown, the session is serialized to disk. When tomcat is started and the page is reloaded in the browser with the old session cookie, the following error occurs:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

Andrus Adamchik
added a comment - 19/Feb/11 10:51 Issues with Tomcat 7.0.8 deserialization. Given a web app similar to Cayenne web tutorial with a session containing a DataContext with one object. When Tomcat is shutdown, the session is serialized to disk. When tomcat is started and the page is reloaded in the browser with the old session cookie, the following error occurs:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:97)
root cause
java.lang.NullPointerException
org.apache.cayenne.query.BaseQueryMetadata.resolve(BaseQueryMetadata.java:103)
org.apache.cayenne.query.SelectQueryMetadata.resolve(SelectQueryMetadata.java:44)
org.apache.cayenne.query.SelectQuery.getMetaData(SelectQuery.java:143)
org.apache.cayenne.util.ObjectContextQueryAction.<init>(ObjectContextQueryAction.java:79)
org.apache.cayenne.access.DataContextQueryAction.<init>(DataContextQueryAction.java:49)
org.apache.cayenne.access.DataContext.onQuery(DataContext.java:999)
org.apache.cayenne.access.DataContext.performQuery(DataContext.java:988)
org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.cayenne.configuration.web.CayenneFilter.doFilter(CayenneFilter.java:97)