cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI lookup for external SessionBean fails

Former Member
0 Kudos

Hello, i have a problem i've been trying to solve all day and would appreciate it if you could help me.

I have an Ear file with an EJB Session Bean(EAR: EigenlijstenEar/EJB: EigenlijstenEJB) which i am attempting to use in a servlet in another web/ear (Web: HagaPortalWeb/EAR: HagaPortalEar). I have read and followed the guidance of http://help.sap.com/saphelp_nw04/helpdata/en/55/29ed5eff965448941c0b42f01b9804/frameset.htm, but to no avail.

The error i get is: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name webContainer/applications/hagaziekenhuis.nl/HagaPortalEar/HagaPortalWeb/java:comp/env/ejb/EigenlijstenSessionBean, cannot resolve object reference. [Root exception is com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at EigenlijstenEar, the whole lookup name is localejbs/hagaziekenhuis.nl/EigenlijstenEar/EigenlijstenSessionBean.]

my lookup code in a servlet in HagaPortalWeb:

Context ctx = new InitialContext();

EigenlijstenSessionLocalHome eigenlijstenHome =

(EigenlijstenSessionLocalHome) ctx.lookup(

"java:comp/env/ejb/EigenlijstenSessionBean");

content of my web.xml in HagaPortalWeb:

<ejb-local-ref>

<ejb-ref-name>ejb/EigenlijstenSessionBean</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<local-home>nl.hagaziekenhuis.medisurf.ejbs.eigenlijsten.EigenlijstenSessionLocalHome</local-home>

<local>nl.hagaziekenhuis.medisurf.ejbs.eigenlijsten.EigenlijstenSessionLocal</local>

<ejb-link/>

</ejb-local-ref>

content of my application-j2ee-engine.xml in Ear project HagaPortalEar:

<reference

reference-type="hard">

<reference-target

provider-name="hagaziekenhuis.nl"

target-type="application">EigenlijstenEAR</reference-target>

</reference>

Accepted Solutions (1)

Accepted Solutions (1)

siddharth_jain
Active Contributor
0 Kudos

HI Arie,

If you are accessing enterprise beans with J2EE clients (servlets, JSP, other enterprise beans, J2EE application clients), do not specify and use this arbitrary JNDI name. Instead, define EJB references in the clientsu2019 deployment descriptors and access the beans using these references. For more information, check the following link

http://help.sap.com/saphelp_nw04/helpdata/en/a0/019b3e25f95f14e10000000a114084/content.htm

if the above does not work try the following:--

Try to lookup the Ejb by its JNDI name given in the EJB-J2ee-engine.xml file if it does not exist there give any valid name and try to lookUp.

or try to lookup the ejb by its default jndi name.

"localejbs/bean name>"

http://help.sap.com/saphelp_nw04/helpdata/en/38/3e5a4201301453e10000000a155106/frameset.htm

in the Above link refer the second option "Lookup from a Non-J2EE Java Application"

Siddharth

Edited by: Siddharth Jain on Aug 22, 2008 7:13 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks, that answered my question.

Although i did look around at the library too much, making me quite dizzy. The simple answer was to look in the visadmin for the real path and try lots of paths until the right one came up. It was:

localejbs/hagaziekenhuis.nl/EigenlijstenEAR/EigenlijstenSessionBean and behold, the thing worked!

thanks for the pointers.

Greetz,

Arie Klop