Skip to main content

@PostConstruct is not working

2 replies [Last post]
snorbicet
Offline
Joined: 2008-02-13

Hello,

I use glassfishv2ur2, and I'd like to use @PostConstruct on a SLSB method:

@Stateless
public class ServiceBean implements Service {
@PostConstruct
private void onCreate()
{
....
}
}

onCreate() is never called and no error is logged.
The EJB is in an ejb-module inside an EAR.

What else should I do to get it to work?

Thanks:
Norbi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ksak
Offline
Joined: 2005-05-20

Did any client invoke this stateless session bean? The container is allowed to delay
instance creation until an actual invocation arrives.

snorbicet
Offline
Joined: 2008-02-13

Yes, business methods are invoked successfully, but the postconstruct method is never called.