cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with JNDI lookup: NamingException

Former Member
0 Kudos

Scenario: I want to search an MDM repository on an MDM server using SAP MDM Connector.For that,I deployed the two SDA’s viz. com.sap.mdm.tech.connector.sda and com.sap.mdm.tech.mdm4j.sda onto the SAP J2EE engine.For testing purpose , I am using a standalone Java class to do a JNDI lookup for the deployed MDM connector.But the lookup is throwing a NamingException.I have added all the JAR files like sapj2eeclient.jar , jndi.jar , Connector.jar , ExtendedConnector.jar etc to the classpath of my application.But still it throws the NamingException.

My code is as follows:

public static void main(String[] args)

{

Context ct =null;

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY,

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

env.put(Context.PROVIDER_URL,"<hostname>:50004");

try {

ct = new InitialContext(env);

} catch(NamingException e)

{

System.out.println("err");

e.printStackTrace();

}

try

{

IConnectionFactory cf =(IConnectionFactory) ct.lookup("deployedAdapters/MDM Factory/shareable/MDM Factory");

IConnectionSpec spec = cf.getConnectionSpec();

/* the code to search catalog follows*/

}catch(Exception e)

{

e.printStacktrace();

}

The exception thrown is:

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name deployedAdapters/MDM Factory/shareable/MDM Factory, cannot resolve object reference. [Root exception is com.sap.engine.services.connector.exceptions.BaseResourceException: Cannot lookup ManageConnectionFactory "MDM Factory". Cannot deserialize object: java.lang.ClassNotFoundException: com.sap.mdm.connector.connection.MdmManagedConnectionFactory

I'll be thankful for any help/suggestions on this.

Accepted Solutions (1)

Accepted Solutions (1)

sid-desh
Advisor
Advisor
0 Kudos

Hi Karambir,

Since you are accessing from standalone java class you also need to user credentials. In the code below you have not given the same.

Try giving the credentials also.

Regards

Sidharth

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karambir,

During the lookup you are using names which have white spaces in it, change the names to continous characters like "MDM_Factory" in the JNDI ( instead of "MDM Factory" that has a space in "MDM" and "Factory") and then call them from your application. I think this will help you.

For issues, reply back and don't forget to give points

Best regards,

Guru.

Former Member
0 Kudos

Sidharth,

I tried specifying the credentials(which i use to login to the VA)but that doesn't help.

Gurvinder,

I don't know how to change the JNDI name in VA.If you could throw some light on this , probably it can help.As of now what i am doing is : login to VA->go to server node->services->JNDI Registry->deployedadapters->MDM Fatory->shareable->MDM Factory.But i don't see any option to edit the JNDI name.

please help.