• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session attribute being removed when not serializable

 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

This is a confusing problem for me that started after changing IDE from Netbeans 6.8 to 7.0.1, and after some refactoring. I have tested a lot and have managed to pin it down a bit.

The problem is that a key session attribute is removed from the session after a file is written. Through using listeners I have found the following:

1. The following version of the attribute is removed after the FileWriter is instansiated.

but this serializable version does not get removed

2. When using the non serialized version of the the above, the attribute is removed when the following code is called

but not when this code is called instead


perhaps it's a memory problem.

Anybody any ideas???

Thanks

Marten

Below is a stack trace on an exception thrown and caught when the attribute is removed
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since a servlet container is allowed to serialize a session any time it wants to, you should never rely on a non serializable attribute being maintained.

Bill
 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill,

I now understand that, I will change my design.

Cheers

Marten
 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so I have changed the design so that only serializable attributes are added to the session, but I still seem to have an underlying problem with the context being destroyed; seemingly randomly.

I get the stack trace below. It seems that the reason that my non serializable attribute problem manifested now was because of some other reason, probably related to changing my IDE.

Any ideas on what this stack trace may means?

Thanks

Marten

 
marten kay
Ranch Hand
Posts: 178
Java jQuery Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so this was an Netbeans IDE - Subversion interaction problem.

I was writting myfiles to inside my WEB_INF folder which I can see in my IDE and is version controlled.

When I write my files to a filepath outside of the application path it all works fine. This problem only started happening when I changed to Netbeans 7.0.1.

There is nothing like problem to show you the world.

Cheers

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic