• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session attribute being removed when not serializable

 
Ranch Hand
Posts: 226
1
jQuery Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 koomen
Ranch Hand
Posts: 226
1
jQuery Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill,

I now understand that, I will change my design.

Cheers

Marten
 
marten koomen
Ranch Hand
Posts: 226
1
jQuery Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 koomen
Ranch Hand
Posts: 226
1
jQuery Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
reply
    Bookmark Topic Watch Topic
  • New Topic