• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Observing Stateful Session Bean @PrePassivate and @PostActivate

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I setup a Stateful Session Bean with eclipse using this example: Eclipse Example

I have added the @PrePassivate and @PostActivate methods to the CounterBean.java class. Each life-cycle callback method will print out a file to the Glassfish session store location so I know when they are called. When I run the application on the Glassfish server I notice a folder is created in the session store location, I assume for storing the stateful bean. I set the timer to something like: @StatefulTimeout(unit = TimeUnit.SECONDS, value = 5).

After 5 seconds @PrePassivate is called and a file is written out. Nothing is stored in the folder created for the stateful session. When I click one of the .jsp links I get:

HTTP Status 500 -

SEVERE: NRU-statefull.CounterBean: Cannot load from BACKUPSTORE FOR Key: <190c06800a81f-15be1285-0>
WARNING: A system exception occurred during an invocation on EJB CounterBean method public void statefull.CounterBean.count()
javax.ejb.NoSuchObjectLocalException: The EJB does not exist. session-key: 190c06800a81f-15be1285-0

I am trying to get the application to store the stateful bean state to secondary storage and then call @PostActivate when a link is clicked again. Also I noticed that the session state is written to the session store folder only when I am running the application and then I reset or stop the Glassfish server.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic