• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Session attribute being removed when not serializable

 
Ranch Hand
Posts: 239
2
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: 239
2
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: 239
2
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: 239
2
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

 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic