cancel
Showing results for 
Search instead for 
Did you mean: 

NameNotFoundException during JNDI lookup for Deployable WebService Proxy

Former Member
0 Kudos

Hi,

I try to comsume (with the current WebAS 2.0.4) a WebService using the deployable WebService Proxies.

1.) The WebService works. I testet it in the WebService Navigator

2.) I generated a deployable Proxy Project an created a proxy. The Service Interface ist named "WSGetPartsBean" (in package test.ws.depclient) the Service Endpoint Interface ist named "WSGetPartsBeanViDocument"

I build the ear file an deployed for this Proxy.

3.) I tried to access the proxy in a web application, using the following code:

-


public String callWebService() throws Exception {

Context ctx = new InitialContext();

WSGetPartsBean service =

(WSGetPartsBean) ctx.lookup("java:comp/env/WSGetPartsBean");

WSGetPartsBeanViDocument port =

(WSGetPartsBeanViDocument) service.getLogicalPort(

WSGetPartsBeanViDocument.class);

String param = "Hello World!";

String result = port.getParts(param);

return result;

}

-


But invoking the method, the JNDI Context Lookup fails:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at : java:comp

at com.sap.engine.services.jndi.implserver.ServerContextImpl.getLastContainer(ServerContextImpl.java:254)

at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:562)

at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:326)

at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:222)

at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:236)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at javax.naming.InitialContext.lookup(InitialContext.java:347)

at test.ws.client.GetPartsBeanWS_WebClient.callWebService(GetPartsBeanWS_WebClient.java:33)

at jsp_myPage1079232206066._jspService(jsp_myPage1079232206066.java:12)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:469)

at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:181)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:373)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:250)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:319)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:297)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:696)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:221)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:146)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:140)

PLEASE HELP!! I checkt the JNDI Browser in the admin tool. there I can see under "webservices --> proxy --> sap.com" the entry "WSGetPartsBean [Context]" and the class names for the implementation.

I tried different names for the Lookup:

WSGetPartsBean

WSGetPartsBeanClient

test.ws.depclient.WSGetPartsBean

test.ws.depclient.WSGetPartsBeanClient

But none works.

Please advise

Stefan

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

hi guys in my scenario the following is the entire project name and proxy name

JDI_AP-AMEA_Dportfolioportfolio_xi_webservice~xxxx.com/com.xxxx.createord.proxy.CreateOrder

it gives me the following error

message.com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name ejbContexts/chep.com/portfolioportfolio_ear/chep.com/portfolioportfolio_ear/OrderFacadeBean/java:comp/env/MI_OnSyncOrderCreateService, cannot resolve object reference. [Root exception is com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at JDI_AP-AMEA_Dportfolioportfolio_xi_webservicechep.com, the whole lookup name is wsclients/proxies/sap.com/JDI_AP-AMEA_Dportfolioportfolio_xi_webservicechep.com/com.chep.createord.proxy.CreateOrder.]

also in the application-j2ee-engine.xml if i set the reference as hard it gives me the following warnning

=> deployed with warning : file:/C:/DOCUME1/gmendonc/LOCALS1/Temp/temp1516chep.comportfolioportfolio_ear.ear

Finished with warnings: development component 'portfolio/portfolio_ear'/'chep.com'/'JDI_AP-AMEA_D'/'20061229134139':

Caught exception during application startup from SAP J2EE Engine's deploy service:

java.rmi.RemoteException: Error occurred while starting application chep.com/portfolio/portfolio_ear and wait. Reason: Clusterwide exception: server ID 2033350:com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Application chep.com/portfolioportfolio_ear cannot be started. Reason: it has hard reference to resource JDI_AP-AMEA_Dportfolioportfolio_xi_webservicechep.com with type application, which is not active on the server.

at com.sap.engine.services.deploy.server.ReferenceResolver.processReferenceToApplication(ReferenceResolver.java:579)

any help ?

Former Member
0 Kudos

Hi,

you have defined the reference that is to be bound to your application’s naming environment. However, to be able to load classes of the referenced proxy interface, you must also set a reference at classloader level. That is, you must set a reference to the corresponding server component in the application-j2ee-engine.xml descriptor in your Enterprise Application Project. To do this, open the application-j2ee-engine.xml editor of the EAR project you created and choose General ® References ® Add® Create New.

a. Reference target – this is the component to which you want to create a reference.

b. Reference type – hard means that your application will not be started if the component is not started. Weak means that it will be started whether the proxy application is deployed or not, but it will not be useable until the proxy is started.

c. Reference target type – this is the type of the component to which you are creating a reference.

d. Provider name – enter sap.com

You can find this in SAP NWDS help.

Former Member
0 Kudos

We are trying to do something similiar to this post. We want to call a web service from a login module and we are getting the same error message.

I created a web project and can call the web service using the information in this post. However, It doesn't work from my login module.

This is the code that we are using to call the web service.

javax.naming.Context context = new javax.naming.InitialContext();

com.sap.a3.proxy.A3Service service = (com.sap.a3.proxy.A3Service) context.lookup("java:comp/env/A3ServiceProxy");

com.sap.a3.proxy.A3ServiceHttpGet port = service.getA3ServiceHttpGet();

String UserID = port.validUser("", "");

Here is the message we are getting.

Path to object does not exist at java:comp, the whole lookup name is java:comp/env/A3ServiceProxy.

We can't figure out where to put the JNDI reference in the login module library project. I believe that maybe this is the problem.

Thanks for your help.

Tim

Former Member
0 Kudos

Hi Tim,

I have the same problem.

Do you figure out a solution ?

Regards,

Gerald

Former Member
0 Kudos

Thanks, it works!

zubev
Employee
Employee
0 Kudos

Hi Stefan,

You have to register a JNDI reference and a classloader reference from your web application to the proxy application.

Unfortunately the help information on the help portal is out of date. AFAIK it will be updated soon.

Meanwhile I will try to explain how to register the references:

1. Add a JNDI reference:

Open the web-j2ee-engine.xml editor (inside your web application project) and choose References. Then select the jndi mapping folder and choose Add. Enter the required data:

a. Application local JNDI name – this is the name by which the proxy is looked up in the application. (if you want to keep the lookup code below, name it WSGetPartsBean).

b. Server Component Name – service or application

c. Server Component JNDI name – the name of the JNDI context by which the proxy is bound. The following convention is used:

/wsclients/proxies/<provider name>/<ApplicationName>/<ProxyName>

If the application name contains "/", it must be replaced by "~".

In your example the JNDI context is:

/wsclients/proxies/sap.com/YourProjectName/test.ws.depclient.YourProxyDefName

where you have to replace YourProjectName and YourProxyDefName with the real values. This is also the real JNDI context and you can get the values from the JNDI service also.

2. Create a classloader reference to the deployable proxy application:

So that your client application can access the proxy classes runtime, you need to provide an application reference, i.e. your web application needs to reference the deployable proxy application

To do this, open the application-j2ee-engine.xml editor of the EAR project (that contains your web app). Choose General -> References -> Add -> Create New.

Enter the corresponding data:

a. Reference Target – this is the proxy project name.

b. Reference Type – hard means that your application will not be started if the proxy application is not started. Weak means that it will be started whether the proxy application is deployed or not, but it will not be usable until the proxy application is started. Choose hard

c. Reference Target Type – select application

d. Provider Name – enter sap.com

Also, there is a button for referencing an application, but I am not sure if it is available in the Sneak Preview.

Don't hesitate to ask me again in any case.

Best regards,

Alexander

Former Member
0 Kudos

It doesn't work for me. I am able to connect to proxy WS and obtain proxy object by:

Object obj = ctx.lookup(JNDI_KEY);

but then i want to cast this object to interface:

pl.com.bcc.mtrm.ws2.Service port = (pl.com.bcc.mtrm.ws2.Service) obj;

and i get ClassCastException. What is "funny": object 'obj' implements interface pl.com.bcc.mtrm.ws2.Service (thats OK), but it is implementing slightly different interface. I tried this condition:

Class[] interfaces = obj.getClass().getInterfaces();

if (Service.class.hashCode() == interfaces[0].hashCode()) {

// OK

}

it returns false, which indicated for me that Service and interfaces[0] are not thesame interfaces. Thats strange for me.

Any suggestions ?

Best regards,

Marcin Zduniak