cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro and EJB on different server

Former Member
0 Kudos

I have a WebDynpro app that will be deployed to server A and that has to access an EJB that will be deployed to server B, server A and server B don't from a cluster.

I don't know how to call the EJB in my WebDynpro app via remote way.

in WebDynpro app call EJB code is:

********************************************

String result = null;

Context ctx = null;

Hashtable env = new Hashtable();

PIEJB remote = null;

PIEJBHome remoteHome = null;

env.put(

Context.INITIAL_CONTEXT_FACTORY,

"com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL, "sapides:50304");

env.put("force_remote", "true");

try {

ctx = new InitialContext(env);

remoteHome =

(PIEJBHome) PortableRemoteObject.narrow(

ctx.lookup("PIEJBBean"),

PIEJBHome.class);

remote = remoteHome.create();

result = remote.getPIAvg("yesterday", "today").getValue();

} catch (Exception e) {

result = e.toString();

}

wdContext.currentContextElement().setTest(result);

******************************************************************************

when run this code,report error:

java.lang.NoClassDefFoundError: com.xxx.piejb.PIEJBHome

but i have add the piejb.jar in Used DC!

can anyone tell me how to do?

thanks advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Ha,

I think You hvae to create An External DC,Add EjbClient jar to that dc and deploy that.create an dependency between web dynpro application and ur external dc.

when you build and deploy any Web dynpro dc what evey jars you will add in web dynpro preferences and in lib foldre those will be not deployed along with ur Web dynpro ear.

Hope this will help u

With Regards

Naidu

Former Member
0 Kudos

I have added EJBClient jar to WebDynpro DC,but not work.

the External EJB DC and WebDynpro DC are not in a same server!

Answers (4)

Answers (4)

Former Member
0 Kudos

HI Ha,

Have you added that Externaal Library to J2ee Server component DC.if so please check the jar file in server through Visual Administrator.

one more important thing is yoy have maintain the reference to library in your web dynroo DC.

tou can set the reference by entering the comlete name of j2ee server component in Web Dynpro references.

With Regards

Naidu

Former Member
0 Kudos

what is the mean "Have you added that Externaal Library to J2ee Server component DC" ? I deployed the library DC, and through VA . I checked the library only contained EJBclient jar .

In WebDynpro references ,I have set the library reference.

Can any one send me an example? or some material?

zp7450@gmail.com

thanks advance!

Message was edited by:

hello ha

Former Member
0 Kudos

Hi

Basically you have to put that ejb inside a webservice and then you can access the webservice using the webdynpro, there is good explanation on you can acomplish this on the following guide <a href="http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2188ae5-0601-0010-dd93-c23e381ef41e">Providing and Consuming Webservices</a>

Hope it helps

Luis Barragá

Former Member
Former Member
0 Kudos

and I got the following error.

____________________________

403

Sorry, you do not have the correct

permissions to access this page.

____________________________

Former Member
0 Kudos

Hi Ha

I just tested the link and it worked fine for me, if you want it, you can give an email and i'll send the pdf guide to you. Besides here you can find a guided example about calling the webserivces methods from a WD on the Using the Car Rental Web Service with Web Dynpro, and on this one you can find information about the development of a webservices using an ejb.

Hope it Helps

Luis Barragá

Former Member
0 Kudos

Hai,

You need to create library DC . add ejbclient.jar to public part . add it in used Dcs in your Wd project. create a j2ee library component , copy your jar fie in server-provider.xml.

deploy it . add library reference fro webdynpro by right click on wd project choose properties-->Webdynrpo references library references.

check this /people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

Regards,

Naga

Former Member
0 Kudos

HI,

External DC doen't mean that EJB DC.

i mean to say you have to creater External Libray DC there you have to add ur EJB client jar

With Regards

Naidu

Former Member
0 Kudos

I created External Libray DC and added EJB client jar.

but also report

java.lang.NoClassDefFoundError: javax/ejb/EJBHome

................

................

The error occurred while trying to load "com.pjs.om.easyform.piejb.PIEJBHome".

Former Member
0 Kudos

I create a library DC, put ejb java files into that, and deploy that on server A.

the error changed:

**********************************

java . lang . NoClassDefFoundError: javax/ejb/EJBHome

…………………………

The error occurred while trying to load "com.xxx.piejb.PIEJBHome".

**********************************

and then I added ejb20.jar (Local Development >SAP-JEE>ejb20 )in WebDynpro app Used DC.

but this also not work!

Former Member
0 Kudos

HI Ha,

try to Deploy Ejb Client jar along with your Web Dynpro Application.

With Regards

Naidu

Former Member
0 Kudos

thanks for you reply Naidu !

you mean copy the EJB client jar into WebDynpro project 's lib folder ?

I'have done, but not work.

Message was edited by:

hello ha