Urgent advice

Mark,

I got little bit of information regarding how it’s invoking the DB2 DB.

“Well, what’s inside the black box is actually important. Depending on how the classes in the jar do things like setting up connection pools or maintaining state, it may or may not be a good candidate to run as a java service in IS.”

It’s reading from a properties file loaded into System. This properties file is a simple flatfile.

My questions are

  1. How to load this properties file into “System”? as I cannot modify the Code given below

private static String getTokenFromProperties(String key)
{
String value = null;
String propPath = System.getProperty("
.properties");
if(prop == null && propPath != null)
{
logger.debug(“Prop value was null. Going to read the property file”);
try
{
FileInputStream in = new FileInputStream(propPath);
prop = new Properties();
prop.load(in);
in.close();
}
catch(FileNotFoundException e1)
{
logger.error("GiftRegistryAPI: can’t find property file " + propPath);
}
catch(IOException e2)
{
logger.error("GiftRegistryAPI: can’t read property file " + propPath);
}
}
if(prop != null)
value = prop.getProperty(key);
return value;
}

Any thoughts???

Use a -D switch on the JVM command-line when starting IS.

Or, write a service that adds the property to the system properties–System.setProperty(“***.properties”, “<path>”). Make this service be a startup of service in its package and then it will be available for the code you listed earlier.

Thank Rob,

I did exactly the same…here is the java service

Properties systemProperties = System.getProperties();
systemProperties.put (“abc.properties”, “C:\webMethods61\IntegrationServer\packages\TestWebServices\config\abc.properties”);
System.setProperties (systemProperties);

No need to get first. Just do this:

System.setProperty(“abc.properties”, “C:/webMethods61/IntegrationServer/packages/TestWebServices/config/abc.properties”);

Note my use of forward slashes, which will work. If you use back slashes you’ll need to double 'em up for the path to parsed correctly.

System.setProperty(“abc.properties”, “C:\webMethods61\IntegrationServer\packages\TestWebServices\config\abc.properties”);

Thanks Rob…

Hello,

Yemi Bedu