Skip to main content

@PostConstruct never called...

2 replies [Last post]
smahr
Offline
Joined: 2007-06-05

Hi,

by reading and browsing google I found several reasons for the PostConstruct method never called.
Unfortunately I could not solve it.

I created several Beans for testing:
- Stateless session bean
- Stateful session bean
- Message Driven Bean

All of those are never called their PostConstruct method.

I tried to access the beans and all business methods work fine besides the PostConstruct.

By reading the spec I found out that this annotated method should be called after dependency injection has been done even if there is no dependency to be injected.

I tried both but it doesn't work.

I use glassfish v2ur2.

Does anyone know the reason for that?

Best Regards,
Sebastian Mahr

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cf126330
Offline
Joined: 2005-03-29

Please post your src code and descriptors.

-cheng

chrjohn
Offline
Joined: 2008-03-11

Hi,

what happens if you name the method, that you want to be called after construction, ejbCreate()?? Is it called then? I had this phenomenon when I had the wrong doctype in the deployment descriptor. I had the EJB2.1 DD instead of EJB3.0.

Cheers
Chris.