• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Observing Stateful Session Bean @PrePassivate and @PostActivate

javadevel devel
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 -

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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic