[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[ajdt-dev] AspectJ and JNDI lookup in WAS
|
hello all,
in my app i have a singleton POJO being called by different EJBs.
one of POJO's method is expecting a DTO object which has a field named containerID.
the containerID is retrieved using a SequenceSession EJB, and that means that every EJB that
needs to call the POJO, will need to have code for retrieving a sequenceID,(from SEquenceSEssionBean) and set the DTO with the
obtained id.
i decided to make it work in a different way. Rather than make all EJB that invoke POJO lookup the
sequenceID to be set in the DTO, i decided instead to allow the EJB to pass a DTO with no
containerID defined.
I have written an aspect that intercept the POJO.createContainer(DTO) so that if the provided DTO
has no containerID defined, one will be retrieved from the session.
I decided tod o that because i have at least 4 EJBs that call the POJO, and i didnt want to write
same method everywhere for getting an ID from the Sequence bean.
I have already encountered the 1st problem: JNDI lookup. It turned out that i cannot use a JNDI reference
to lookup my SequenceSession bean, for the very simple reason taht if the SequenceSessionbean is not
referenced (in deployment descriptor) in the bean that calls the POJO, i will have a null pointer exception
Worst than that, i cannot even use the EJB JNDI Name, since WAS resolve the name to the following
<host>/cell/ + EJB JNDI name
shall i drop aspectj for this issue? if not, what could be a solution to thi sJNDI lookup?
thanks and regards
marco