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

Observing Stateful Session Bean @PrePassivate and @PostActivate

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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 -
javax.ejb.NoSuchEJBException

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.
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic