Re: JNDI lookup from setEntityContext fails with java.lang.IllegalStateException: Can not access other EJBs from within setEntityContext(...)

Evan Ireland <[email protected]>
Newsgroups gmane.comp.java.sun.ejb.general
Message-ID <[email protected]>
Alex,

Looking up a home is "JNDI access to java:comp/env", and does not
constitute "enterprise bean access". Thereby home lookups are
DEFINITELY permitted within setEntityContext/setSessionContext etc.
That is, presuming your home lookups are under the "java:comp/env"
context, e.g.

    orderHome = (OrderEntHomeLocal)
context.lookup("java:comp/env/ejb/OrderEntLocal");

I recently confirmed this with the EJB specification lead.

The product is definitely non-spec-compliant, if lookups to ejb-refs
under "java:comp/env/..." are not permitted from
setEntityContext/setSessionContext.

Also, note that industry standard benchmarks like SPECjAppServer200(1,2)
will not work on any server with this non-compliant behaviour.

> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[email protected]]On Behalf Of Alex Paransky
> Sent: Thursday, 4 September 2003 1:47 a.m.
> To: [email protected]
> Subject: JNDI lookup from setEntityContext fails with
> java.lang.IllegalStateException: Can not access other EJBs from within
> setEntityContext(...)
>
>
> I am trying to port my application from Orion 1.5.3 to Orion 2.0.2.
>
> In all of my beans I lookup a home by accessing new
> InitialContext().lookup() API from the setEntityContext API on my CMP.
> After converting to Orion 2.0.2 I now get  IllegalStateException. This
> worked in Orion 1.5.3. Looking at the ejb 2.0 spec section 10.5.5 table
> 4, java:comp/env access should be allowed. I should be able to lookup a
> home for another bean in setEntityContext.
>
> Section 12.1.4.1 also states that "The instance can take advantage of
> the setEntityContext() method to allocate any resources that are to be
> held by the instance for its lifetime."
>
> Here is the exception I get:
>
> java.lang.IllegalStateException: Can not access other EJBs from within
> setEntityContext(...)
> at com.evermind._cob.lookup(.:22)
> at com.evermind._au._rt(.:129)
> at com.evermind._au.lookup(.:62)
> at javax.naming.InitialContext.lookup(InitialContext.java:345)
> at
> com.standardset.ejb.common.util.LocalHomeFinder.getHome(LocalHomeF
> inder.java:33)
>
> at
> com.standardset.ejb.common.util.LocalHomeFinder.getHome(LocalHomeF
> inder.java:20)
>
> at
> com.myprofiles.model.profile.ProfileEntityHomeFinder.getHome(Profi
> leEntityHomeFinder.java:15)
>
> at
> com.myprofiles.model.member.MemberEntityBean.setEntityContext(Memb
> erEntityBean.java:249)
>
> at
> MemberEntityBean_PersistenceManager20.setEntityContext(MemberEntit
> yBean_PersistenceManager20.java:290)
>
> at com.evermind.server.ejb.EntityEJBHome.getContextInstance(.:266)
> at com.evermind.server.ejb.EntityEJBHome.getLocalContextInstance(.:219)
> at
> MemberEntityHome_EntityHomeWrapper107.findByLogon(MemberEntityHome
> _EntityHomeWrapper107.java:759)
>
> The SPEC is quite vague about this point.  They mention that one can
> access java:comp/env, but does not say anything about EJB Access.  Does
> anyone have a more definitive answer?  Can I lookup a Home interface
> inside setEntityContext/setSessionContext?
>
> I tried to open a bug to Orion, but they closed it stating that their
> implementation is to the spec.
>
> Thanks.
>
> --
> -AP_
> http://www.myprofiles.com/member/profile/apara_personal
> http://www.myprofiles.com/member/profile/apara_business
>
> ==================================================================
> =========
> To unsubscribe, send email to [email protected] and include
> in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [email protected] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.