cancel
Showing results for 
Search instead for 
Did you mean: 

ApplicationPropertiesAccess

Former Member
0 Kudos

Hello everybody,

does anybody know how to do this?

I execute the following coding:


try {
// Obtain the JNDI context
	Hashtable<String, String> prop = new Hashtable<String, String>();
	prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
	prop.put(Context.PROVIDER_URL, "servername:50004");
	InitialContext ctx = new InitialContext(prop);

// access the Application-Configuration-Façade service
ApplicationPropertiesAccess appCfgProps =   (ApplicationPropertiesAccess)ctx.lookup("ApplicationConfiguration");

java.util.Properties appProps =	appCfgProps.getApplicationProperties();
if (appProps==null) {
//do something
   } else {
//do something else
   }
}catch(Exception e) {
	e.printStackTrace();
}

The help page http://help.sap.com/saphelp_nwpi71/helpdata/en/45/c88109a0df570de10000000a114a6b/frameset.htm suggests just an initial InitialContext, so without properties. If I do this, I immediately get the exception that the naming factory is not provided. Same for the URL, this seems to be mandatory. Executing this code the server is accessed, but I receive the exception as follows:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of ApplicationConfiguration.

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

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRedirectableImpl.java:80)

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImplp4_Skel.dispatch(ServerContextRedirectableImplp4_Skel.java:872)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)

at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)

at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)

at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)

at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)

at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)

at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)

-

-


predecessor system -

-


com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of ApplicationConfiguration.

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

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRedirectableImpl.java:80)

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImplp4_Skel.dispatch(ServerContextRedirectableImplp4_Skel.java:872)

at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)

at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)

at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)

at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)

at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)

at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)

at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)

at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)

Seems like the parameters for my special application cannot be found. They're uploaded, however, I can see them in the NWA. Is any special environment parameter needed for the InitialContext? I don't see how the system is able to know which application I request (I'm executing a test method locally for testing).

Would be nice if somebody could help me, I don't want to open yet another OSS message to this topic...

Regards,

Jörg

Edited by: Joerg Thiesmann on Apr 20, 2009 10:10 AM

Edited by: Joerg Thiesmann on Apr 20, 2009 10:13 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Jörg,

This is only available to the application that has deployed the properties within itself, hence only in server environment. (That's also the explanation for the empty new InitialContext.)

For more information please refer to the overview page.

HTH!

-- Vladimir

Former Member
0 Kudos

Hello Vladimir,

yes, thanks a lot, that helped! I can deploy the attributes now and access them. However, sometimes behaviour seems a bit strange. For example, first I deployed "servername" as a value, then I noticed that you need to deploy attributes without quotation marks, so just servername. For all attributes this works, except for the servername. Although I deleted the quotation mark in the properties file they're still deployed like this on the server. I can override this with a custom value, of course.

Also I had a value which I wanted to delete later. I deleted it from the prop file, but in the NWA the value was still visible. Only Undeployment and Redeployment solved this issue.

Fine feature, although it makes local testing impossible (if you don't include hardcoded values for this case in your coding).

Regards,

Jörg