Skip to Content
author's profile photo Former Member
Former Member

Deployable proxy -JNDI lookup

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2007 at 08:34 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 27, 2007 at 08:38 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2007 at 03:26 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 02:38 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.