On 08/07/2012 10:17 PM, Laird Nelson wrote:
> I have a stateless session bean that is attempting to examine its
> environment during construction.
>
> I had a programmatic JNDI lookup of the java:comp/env context from the
> constructor. This is failing.
>
> I am aware that I could perform this lookup from a @PostConstruct
> method instead, but then I could not initialize certain final fields
> with the return value.
>
> Is such a lookup possible only in a @PostConstruct method? Does the
> specification prohibit a lookup of this kind from the constructor
> directly?
EJB 3.1 FR 4.7.2 Operations Allowed in the Methods of a Stateless
Session Bean Class
In table 2 it shows what you are allowed to do in the constructor.
Essentially, nothing.
Carlo
>
> Thanks,
> Laird
>
> --
> http://about.me/lairdnelson
>