Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

On DB Connections, MVC2, and Sessions  RSS feed

 
Keenon Han
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have some questions for you. I cannot specifically point out what kind of problem I am encountering in my application, but here's what's happening:

- I have a web application project deployed in the Sun Glassfish Sever, the project follows the MVC2 architecture.
- I am using connection pool for database connection.
- I have an OracleDAOFactory with one method getConnection() which gets a DataSource object from the connection pool.
- I have a SuperDAO which creates a Connection object by calling the getConnection() method in the OracleDAOFactory. This call to getConnection() is in its constructor.
- Within SuperDAO I have methods like performQuery(String query), performUpdate(String query), etc that performs/executes the passed String query, using the established Connection object.

- I have a couple of OracleDAO's (i.e UserOracleDAO) that extends SuperDAO and within this OracleDAO's resides my calls to performQuery() or updateQuery() of the SuperDAO class. In each OracleDAO I have placed a call to super() in their constructor, which basically establishes a connection.

I have TransferObjects and ListHandlers that I forward to JSP pages to be retrieved, some of them set to scope = 'page', some of scope 'session'.

Now my PROBLEM is:

After a couple of times clicking back and forth from page to page, the application crashes and the server logs something like:
PWC2785: Cannot serialize session attribute userDetails for session 126658c15dd936e42f4cdbb63a85

I am not sure whether this is because there are ResultSets that have remained unclosed (although I have tried to locate and close each instance of it that I've seen) within the application or is it with the way I assigned the scope of my usebeans. I hope you can forgive me if what I wrote may seem basic but I have just been studying J2EE and is not too familiar yet with the best practices for it and the implications of using the scope of the variable I am using.

Or can my problem be solved by simply adjusting the settings of my connection pool?

Thank you so much and I appreciate all of your response.

Rgs,
Keenon
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that every object bound to session (directly or indirectly) implements Serializable. Also make sure that none of these object contain references to things that can not be serialized (like Connection, Statement, ResultSet, file handles, etc...)..
 
Keenon Han
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben I appreciate the help. Will do what you said.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!