cancel
Showing results for 
Search instead for 
Did you mean: 

Deployable proxy -JNDI lookup

Former Member
0 Kudos

Hi All,

I've created a Deployable proxy for my webservice and deployed the EAR. I can see JNDI registry in the visual administrator.

I am now writing a simple java client to call the proxy.

1.

try {

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL, "localhost:50104");

Context ctx = new InitialContext(env);

Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight");

FlightListService ser=(FlightListService)obj;

}

Lookup went fine…but I am getting classcastexception at the stsetment "FlightListService ser=(FlightListService)obj;"

2.

try {

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL, "localhost:50104");

Context ctx = new InitialContext(env);

Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight/com.sap.flight");

FlightListService ser=(FlightListService)obj;

}

In the above case Lookup itself failed.

Please let me knowthe solution.

Regards,Anilkumar

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi!

Did you ensure that the EAR which contains your WebService Proxy is running properly. When an EAR gets an Exception normally also gets stopped, throwing a ClassCastException in future calls.

Hope this helps.

Eneko.

Message was edited by:

Eneko Rodriguez

Former Member
0 Kudos

Followed the suggestions from all...But still i am facing the same prob.

Anil

Former Member
0 Kudos

Hi Anilkumar,

the easiest way to help yourself is to debug your application and set a breakpoint before you cast and investicate the obj, which is returned from jndi-lookup.

if you develop on CE or java5 based webas use annotations instead of jndi.

Regards, Jens

Former Member
0 Kudos

Hello Anikumar,

i think the problem is in direct casting <b>obj</b> to <b>FlightListService</b>.

Please try following code:


...
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("/wsclients/proxies/sap.com/flight");
...
FlightListService ser = (FlightListService)javax.rmi.PortableRemoteObject.narrow(obj, SubjektHome.class );
...

regards,

mz

Former Member
0 Kudos

AnilKumar,

I have consumed similar Deployable WebService from an EJB and I remeber that I gave the Deployed Webservice EAR (Deployed WebService Proxy EAR) as a Application level reference in the application-j2ee-engine XML of the EAR surrounding the consuming EJB (Application EAR).

How have you defined reference in your case.

Also I had a lookup as below


InitialContext ctx = new InitialContext();
ZPointtoPointServiceService zpserv = (ZPointtoPointServiceService) ctx.lookup("wsclients/proxies/sap.com/DeployableWebServices/com.web.comp.RFCWebService");

ZPointtoPointService zpp =(ZPointtoPointService) zpserv.getLogicalPort();

Regards,

Sudharshan N A