We have a custom Authenticator that extends resin's
com.caucho.server.security.AbstractAuthenticator. In our custom
authenticator, I am storing a Hibernate object that contains a HashSet
of other Hibernate objects in my HTTP session. When I restart Resin
(Resin 4.0.16), I am getting the following stack trace that is caused by
a "org.hibernate.LazyInitializationException" when I access the first
Web page after the server is started.
It looks like resin is deserializing the Hibernate object from resin's
session persistence and then trying to populate the Set of associated
Hibernate objects, but the Set object that originally contained the
associated Hibernate objects does not exist. I am guessing that is the
problem because I see the following cause:
> [11-03-25 14:56:04.683] {http://*:8082-1}
> com.caucho.hessian.io.HessianFieldException:
> com.marinersupply.common.authentication.ApplicationUser.roles:
> java.util.Set cannot be assigned from null
I am using the java.util.HashSet to contain the associated Hibernate
objects. If this is the problem, why isn't resin also serializing the
HashSet?
Doesn't Resin's session serialization serialize objects associated with
objects that are in the HTTP session?
Does resin's session persistence mechanism invoke the methods on the
objects stored in the session when it serializes or unserializes the
objects from the session store?
The reason that I ask this problem is that I get the following Exception:
> Caused by: org.hibernate.LazyInitializationException: failed to
> lazily initialize a collection, no session or session was closed
Why is resin invoking Hibernate to perform a lazy load of associated
objects on my hibernate object? I've seen cause the error above when it
tried to persist the hibernate object at the end of processing an HTTP
request. We use a servlet filter to close the Hibernate session. It
looks like the act of persisting the session is occurring after resin
has returned from this filter because the Hibernate session was closed.
My question again is "why is resin invoking the methods on the object
that in turn makes a request to hibernate to lazy load the associated
objects?"
Is resin using Hibernate as a part of its default session persistence
implementation?
We didn't see any of these errors when we were running Resin 3.0.28.
But, in Resin 3.0.28, we were using Resin's MySQL session persistence.
In resin 4.0.16, we are using Resin's default session persistence store.
I would appreciate any ideas on what might be going so I can track down
the problem.
Thanks,
Keith
> [11-03-25 14:56:04.680] {http://*:8082-1}
> com.caucho.hessian.io.HessianFieldException:
> com.marinersupply.common.authentication.ApplicationUser.roles:
> java.util.Set cannot be assigned from null
> at
> com.caucho.hessian.io.UnsafeDeserializer.logDeserializeError(UnsafeDeserializer.java:790)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:421)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:239)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150)
> at
> com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2212)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1719)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1703)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:239)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150)
> at
> com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2212)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2133)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2117)
> at
> com.caucho.server.session.HessianSessionDeserializer.readObject(HessianSessionDeserializer.java:79)
> at
> com.caucho.server.session.SessionImpl.load(SessionImpl.java:686)
> at
> com.caucho.server.session.SessionImpl.load(SessionImpl.java:642)
> at
> com.caucho.server.session.SessionManager.createSession(SessionManager.java:1332)
> at
> com.caucho.server.http.AbstractCauchoRequest.createSession(AbstractCauchoRequest.java:255)
> at
> com.caucho.server.http.AbstractCauchoRequest.getSession(AbstractCauchoRequest.java:198)
> at
> com.caucho.security.AbstractLogin.findSavedUser(AbstractLogin.java:352)
> at
> com.caucho.security.AbstractLogin.getUserPrincipal(AbstractLogin.java:251)
> at
> com.caucho.server.http.AbstractCauchoRequest.getUserPrincipal(AbstractCauchoRequest.java:502)
> at
> com.caucho.server.security.RoleConstraint.isAuthorized(RoleConstraint.java:73)
> at
> com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:103)
> at
> com.caucho.server.cache.ProxyCacheFilterChain.doRequestCacheable(ProxyCacheFilterChain.java:245)
> at
> com.caucho.server.cache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:188)
> at
> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
> at
> com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
> at
> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287)
> at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:792)
> at
> com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:730)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:689)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:669)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:617)
> at
> com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:104)
> at
> com.caucho.network.listen.ConnectionReadTask.runThread(ConnectionReadTask.java:98)
> at
> com.caucho.network.listen.ConnectionReadTask.run(ConnectionReadTask.java:81)
> at
> com.caucho.network.listen.AcceptTask.run(AcceptTask.java:67)
> at
> com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
> at
> com.caucho.env.thread.ResinThread.run(ResinThread.java:130)
> Caused by:
> org.hibernate.LazyInitializationException: failed to lazily initialize
> a collection, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> at
> org.hibernate.collection.PersistentSet.add(PersistentSet.java:189)
> at
> com.caucho.hessian.io.CollectionDeserializer.readLengthList(CollectionDeserializer.java:93)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1770)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417)
> ... 38 more
> [11-03-25 14:56:04.683] {http://*:8082-1}
> com.caucho.hessian.io.HessianFieldException:
> com.marinersupply.common.authentication.ApplicationUser.roles:
> java.util.Set cannot be assigned from null
> at
> com.caucho.hessian.io.UnsafeDeserializer.logDeserializeError(UnsafeDeserializer.java:790)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:421)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:239)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150)
> at
> com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2212)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1719)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1703)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:239)
> at
> com.caucho.hessian.io.UnsafeDeserializer.readObject(UnsafeDeserializer.java:150)
> at
> com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.java:2212)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2133)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2117)
> at
> com.caucho.server.session.HessianSessionDeserializer.readObject(HessianSessionDeserializer.java:79)
> at
> com.caucho.server.session.SessionImpl.load(SessionImpl.java:686)
> at
> com.caucho.server.session.SessionImpl.load(SessionImpl.java:642)
> at
> com.caucho.server.session.SessionManager.createSession(SessionManager.java:1332)
> at
> com.caucho.server.http.AbstractCauchoRequest.createSession(AbstractCauchoRequest.java:255)
> at
> com.caucho.server.http.AbstractCauchoRequest.getSession(AbstractCauchoRequest.java:198)
> at
> com.caucho.server.http.AbstractCauchoRequest.getSession(AbstractCauchoRequest.java:176)
> at
> com.marinersupply.common.authentication.ApplicationUserAuthenticator.getUserPrincipal(ApplicationUserAuthenticator.java:103)
> at
> com.caucho.server.security.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:77)
> at
> com.caucho.security.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:218)
> at
> com.caucho.security.BasicLogin.getUserPrincipalImpl(BasicLogin.java:124)
> at
> com.caucho.security.AbstractLogin.getUserPrincipal(AbstractLogin.java:261)
> at
> com.caucho.server.http.AbstractCauchoRequest.getUserPrincipal(AbstractCauchoRequest.java:502)
> at
> com.caucho.server.security.RoleConstraint.isAuthorized(RoleConstraint.java:73)
> at
> com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:103)
> at
> com.caucho.server.cache.ProxyCacheFilterChain.doRequestCacheable(ProxyCacheFilterChain.java:245)
> at
> com.caucho.server.cache.ProxyCacheFilterChain.doFilter(ProxyCacheFilterChain.java:188)
> at
> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
> at
> com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
> at
> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:287)
> at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:792)
> at
> com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:730)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:689)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:669)
> at
> com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:617)
> at
> com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:104)
> at
> com.caucho.network.listen.ConnectionReadTask.runThread(ConnectionReadTask.java:98)
> at
> com.caucho.network.listen.ConnectionReadTask.run(ConnectionReadTask.java:81)
> at
> com.caucho.network.listen.AcceptTask.run(AcceptTask.java:67)
> at
> com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
> at
> com.caucho.env.thread.ResinThread.run(ResinThread.java:130)
> Caused by:
> org.hibernate.LazyInitializationException: failed to lazily initialize
> a collection, no session or session was closed
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
> at
> org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
> at
> org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
> at
> org.hibernate.collection.PersistentSet.add(PersistentSet.java:189)
> at
> com.caucho.hessian.io.CollectionDeserializer.readLengthList(CollectionDeserializer.java:93)
> at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1770)
> at
> com.caucho.hessian.io.UnsafeDeserializer$ObjectFieldDeserializer.deserialize(UnsafeDeserializer.java:417)
> ... 42 more
--
-----------------------------------------------------------------
Keith Fetterman Direct: 206-319-9434
Mariner Supply, Inc. 206-780-5670
http://www.go2marine.com [email protected]
http://www.boatersline.com
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest