cancel
Showing results for 
Search instead for 
Did you mean: 

Java System Properties: Parameter returning null

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

saar_dagan
Employee
Employee
0 Kudos
Former Member
0 Kudos

Hi Saar,

Thanks for your effort.

I have tried these links but no success.

Thanks & Best Regards,

Ankur