Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to handle non serializable objects during ejb passivation?

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am injecting javax.mail.Session using Resource annotation. As Session does not implement Serializable interface, I am getting NotSerializableException during ejbPassivate.



I am able to fix this by setting session to null in @PrePassivate method and then again looking up in @PostActivate method



Here we have to look up for Session again. Is there any better approach to fix this?


Thanks,
Krishan
 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

i think it doesn't matter if we configure CallbackMethods if we want to use any Resources in EJBContainer..
or do you want to use only PropertyInjection?..
i think the PropertyInjection, SetterInjection and Through callback methods is all the same, and all of it offer ease way to getting resources that we want..
the important thing when we use one of that is we want use resources provided by EJBContainer..

Please correct me if i'm wrong...

Thanks..
 
Krishan Chauhan
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leonardo,

I dont want to lookup again for Session in callback method when I have injected it. Is there any way to configure this?
Here I am injecting and then looking up, so I am not getting full advantage of injection.

Thanks,
Krishan
 
    Bookmark Topic Watch Topic
  • New Topic