cancel
Showing results for 
Search instead for 
Did you mean: 

cannot access javax.ejb.EJBHome

Former Member
0 Kudos

Hi All,

I created a EJB DC project and trying to invoke through Webdynpro DC Project. I am using NWDS CE 7.11.

1. Entity Forwarding was enabled in EJB in Development Infrastructure.

2. Public part was added to ear

3. In webdynpro Dc project - the ear was added as the Dependency.

4. Add the ejb20 jar files to the DC Project External Libraries.

Context Initial_Context = new InitialContext();

InitialContext ctx = new InitialContext();

String Look_Up_String = "demo.sap.com/empname_ear/Empname_ejbBean";

obj = ctx.lookup(Look_Up_String);

Empname_ejbHome home = (Empname_ejbHome)javax.rmi.PortableRemoteObject.narrow(obj,Empname_ejbHome.class);

But when i write the code to get the Bean methods, i am unable to see the EJB Name.

empname_ejb localobject = home.create();

In the above line, i am unable to see "employeename_ejb" .

The Look Up string is correct as i got the JNDI Name from SAP NWA.

What else i required? Please do help me in this.

Thanks and Regards,

Divya

Plw

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Used JPA and solved the issue.

Former Member
0 Kudos

Hi Divya,

It seems that your EJB is not exposed as a public part.

Go to your ejbmodule.

Click on Windows->Show View->Development Infrastructure->Component Properties->Public Parts->Add the EJBs which you

want to expose to the other DC.

Hope this helps to solve the problem.

Regards,

Radhika

Former Member
0 Kudos

Hi radhika,

Thanks. But i had already added that Public Part to EAR and add it to my webdynpro DC project - component properties - ADD Dependencies.

Pls do help me in this regard.

Divya

Former Member
0 Kudos

Hi Radhika,

I am able to see the Bean name and the Home,local and remote interfaces. But i cannot not able to see the EJB Name.

Is the procedure / code required for calling the EJB 3.0 inside webdynpro different for NWDS CE 7.11. Is there any tutorial available for this?

I even created a local ejb and webdynpro project. the same error.

Inside i gave webdynpro sharing reference, project reference , java build path - project and added the required external libraries. but still the same error.

Is there any other way to overcome this error.

Please do help me in this regard. I am stuck here.

Thanks,

Divya

Former Member
0 Kudos

Hi Divya,

Please refer to this document.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b030e7fb-2662-2b10-0dab-c4aa52c35...

Just see if you missed any step

Hope it helps.

Regards,

Radhika

Former Member
0 Kudos

Hi Radhika,

Is this Invoking EJB through webdynpro cant be acheived by using the specified code.Is it not possible to use that Look Up Method in NWDS CE 7.11 . Here in this document they are creating a Enterprise Java Bean Model. Is it not possible to achieve this without using a model as we do in the older versions.

InitialContext ctx = new InitialContext();

String Look_Up_String = "demo.sap.com/empname_ear/Empname_ejbBean";

obj = ctx.lookup(Look_Up_String);

Empname_ejbHome home = (Empname_ejbHome)javax.rmi.PortableRemoteObject.narrow(obj,Empname_ejbHome.class);

empname_ejb localObject = home.create();

String name = localObject.getname();

java.util.ArrayList arrlist = localObject.getarrlist();

Is this way not possible?

Regards,

Divya

Former Member
0 Kudos

Hi Divya,

If you do not want to use the EJB Model import, you can still go for the method of Context lookup in web dynpro.

Please refer to the following wiki, which talks about connectivity to oracle database using EJBs. You can read it and apply the same logic for your requirement.

http://wiki.sdn.sap.com/wiki/display/WDJava/OracleConnectivitywithEJBusingWebDynproApplication

Regards,

Radhika

Edited by: Radhika Parag Rajopadhye on Oct 11, 2010 8:08 AM

Former Member
0 Kudos

Hi,

Thanks Radhika for the help. I tried it. Was getting the same error. I achieved it using JPA. I am Closing the thread.

Thanks.

Divya