cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing EJB from JSP Dynpage.

Former Member
0 Kudos

Hello,

Can some one tell me how I can access an EJB from a JSP Dynpage.

Best Wishes,

John.

Message was edited by: John Bray

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi John,

This <a href="http://help.sap.com/saphelp_nw04/helpdata/en/88/bdfc3f48ecc742e10000000a1550b0/frameset.htm">link</a> will help u..

Or try doing these steps:

1) Create the ejb & pack it into an ear. Give a JNDI name for the ejb, let's call it My_JNDI. Deploy the ear.

(For specifying the JNDI name through NWDS, in J2EE perspective of the NWDS, double click on ejb-j2ee-engine.xml file. select your bean from the right side view and then specify a Jndi name)

2) Create the Portal project, select the EAR project in the project references. Select the EJB project in JavaBuildPath->Projects and JavaBuildPath->Order&Export.

3) Write the following lines of code to call the ejb method.

InitialContext context = new InitialContext();

Object Obj = context.lookup("MY_JNDI");

<Bean_name>Home home = (<Bean_Name>Home)javax.rmi.PortableRemoteObject.narrow(Obj,<Bean)_name>Home.class);

<Bean_name> bean = home.create();

// call the bean method ....bean.<method>();

4) Edit your portalapp.xml. Add the following line of code in your <application-config> tag.

<property name="PrivateSharingReference" value="SAPJ2EE::sap.com/MyEAR_Project"/>

5) Run your application.

Before you run your application, you may check if the ear has been deployed correctly:

1) Open Visual Administrator, Go to Server->Deploy. Select application & make sure the service sap.com\<your_EAR_name> is running. You can find the bean inside the Ejb_Container of this service.

2) In Visual Admin, go to Server->JNDI Registry. Verify that you have your JNDI name listed directly under the Regisrt and also under 'ejbCosNaming'.

Regards,

Pooja.

Former Member
0 Kudos

Hello Pooja,

Thank you very much for the help and also for the Link to relevant material.

Pooja, would you have any idea how I can change the namespace for e.g: sap.com/JohnEar to john.com/JohnEar any help would be highly appreciated.

Best Wishes,

John.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi John,

Try this <a href="https://www.sdn.sap.com/irj/sdn/thread?threadID=118739">thread</a>.

See this <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/b0/2beb7a371c4649b2ceec901248ef31/frameset.htm">link</a> also.

Regards,

Pooja.