Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Java System Properties: Parameter returning null

Hi All,

I have a requirement to create a property in EJB DC which is configurable through NWA.

For this, I have created an EJB DC & EAR DC.

In the META-INF folder of EAR DC, I have created “sap.application.global.properties” file. 

In file, I have created the required property. The properties are getting displayed in NWA also, when deployed.

In the java file of EJB DC, I am implementing the below code to read the required property.

InitialContext appCtx = new InitialContext();

  ApplicationPropertiesAccess appCfgProps = (ApplicationPropertiesAccess)appCtx.lookup("ApplicationConfiguration");

  if(appCfgProps != null){

  logger.infoT("[ApplicationConfiguration] appCfgProps.toString() = "+appCfgProps.toString());

  java.util.Properties appProps = appCfgProps.getApplicationProperties();

  if(appProps != null){

  String oldUri = appProps.getProperty("oldUri");

  logger.infoT("[ApplicationConfiguration] oldUri = "+oldUri);

  }else{

  logger.infoT("[ApplicationConfiguration] appProps is NULL");

  }

  }else{

  logger.infoT("[ApplicationConfiguration] appCfgProps is NULL");

  }

But the parameter “appProps” is getting returned as null, due to which null pointer exception occurs &  I’m not able to fetch the required property.

Can you please advise how to resolve this.

Thanks & Regards.

Ankur

Not what you were looking for? View more on this topic or Ask a question