Skip to Content
author's profile photo Former Member
Former Member

Look up EJB in JNDI

Hi,

I am trying to use an EJB from a web dynpro application. The EJB is given a name as "MaterialBatchBean" as follows:

<ejb-j2ee-engine>

<description>

</description>

<enterprise-beans>

<enterprise-bean>

<ejb-name>MaterialBatchBean</ejb-name>

<jndi-name>MaterialBatchBean</jndi-name>

<entity-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

When I try to look up this EJB using the following codes, it always complains about the incorrect path:

InitialContext ctx = new javax.naming.InitialContext();

MaterialBatchHome mbHome = (MaterialBatchHome) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/ejb/MaterialBatchBean"),MaterialBatchHome.class);

Does anyone know what is wrong here? Your help is appreciated!

Hart

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 20, 2005 at 03:52 AM

    Hi Hart,

    You can check the exact path of your EJB from the Visual Admin. In the Visual Admin, go to service EJB Container -> Beans. Then drill down to your ejb project and your ejb. You can then see the path from the JNDI Name field on the right.

    Also, rememeber that you need to set the reference to this EJB from your Web Dynpro project properties when you lookup ejb from your code implementation and not using model.

    Regards,

    Marc

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Vladimir Pavlov

      Hi guys,

      Looks like I am the one who should apologize...

      No fighting or offending please, at least not on a word by which nothing bad was really meant.

      It is very hard not to agree with Detlev's viewpoint of helping others through SDN forums. I believe this is what all the other SDN members, or we say, SDN friends think.

      Back to my previous question, I did have an impression that the prefix "java:comp/env" is not needed anymore, but this is only my assumption, not a conclusion made from Detlev's posting.

      With Vladimir's note, I am now much more clear about this.

      Thanks again my friends!

      Hart

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.