grails Sql error [duplicate]
I was getting issue wen using new Sql method in grails .
import groovy.sql.Sql
def datasource
def organization_config = new Sql(dataSource)
def orgs = organization_config.rows("select o.organizationId,o.name from organization o ")
session.setAttribute("org_results", orgs);
The application is running but getting these errors when restart tomcat server.
SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: groovy.sql.GroovyRowResult java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: groovy.sql.GroovyR开发者_如何学PythonowResult
Can any one please tell me wy this is coming .
thanks in advance, sri..
Tomcat can persist session accress shutdowns and restarts if all your session objects implement java.io.Serializable
. If session objects do not implement java.io.Serializable
your session cannot survive a shutdown and restart. In your case objects of type groovy.sql.GroovyRowResult
do not implement java.io.Serializable
.
The message can be considered harmless in terms of functionality during uptime as long as you do not cluster multiple Tomcat instances to serve your application. In this case you really should implement this interface in every class your put into the session. Otherwise Tomcat cannot ship the sessions between multiple cluster nodes.
- JavaDoc for interface java.io.Serializable
- Sun Article Discover the secrets of the Java Serialization API
精彩评论