Static Properties File

I am loading a properties file into a static variable in the start up service in my package.

However, once in a while, when I try to run the other services in the package, the static variable seems to lose its content.

Any ideas ?

Hi Stephen,
I had this problem too.
Actually I got no idea how to solve this issue, but I changed the way I load the static file content.
Instead of load it into JVM memory, I created a storage and now the static file content is loaded there at startup.

HTH,
Maldonado

I believe that each package in IS has it’s own class loader, so your properties file will be loaded with the same class loader for whatever package it’s in. So if you reload a package or reimport a new version you will probably lose the value. How are you getting the value initiated? manually running the java service? You might want to add a startup service to the package so it runs your code when the package is reloaded/enabled or when the server starts up.

However it’s been a while since I’ve used those properties files. We used the extended settings or TN for all our properties.

I had the same problem and I tried to fix it with a startup service that reloads the properties file with every startup. But it did not work. From time to time the properties vanished. wkriski’s posting brought me to the idea to load the properties into a static variable that resides at a class into the “jars/static” folder. I.e. the classes from the jars/static folder are loaded with the server classloader. Since then the variables are accessible.