on 01-31-2007 5:05 AM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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á
Hi Luis Barragán
I can't open the URL. https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2188ae5-0601-0010-dd93-c23e381e...
that you provided
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á
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Ha,
try to Deploy Ejb Client jar along with your Web Dynpro Application.
With Regards
Naidu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.