Access properties files outside a jar (local machine)

Hi, i’ve a classes inside a jar (imported with the local maven repositoty) whose purpose is to access a properties file, placed outside the jar (modules\web\src\application.properties). On local server deployment (my machine) the compiler shows this error: “Can’t find bundle for base name”, whereas in production mode, the error disappear. Any workaround?

This is a part of my class.

public class Application {
private static final String BUNDLE_NAME = “application”;//$NON-NLS-1$
static Logger log = Logger.getLogger(Application.class);
private static ResourceBundle RESOURCE_BUNDLE ;

static {
	try {
		RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
	}
	catch (Exception e) {
		log.warn("application.properties mancante",e);
	}
}

}

Hi,

First thing - if you load some abstract properties and not localized messages, I would use java.util.Properties class and java.util.Properties#load(java.io.InputStream) method.

ResourceBundle class is more targeted towards localized messages.

2 - CUBA has Resources bean intended to load resources from files:
https://doc.cuba-platform.com/manual-7.1/resources.html

You need to place your file to the so called application configuration folder.
On production environment location of this folder depends on your deployment method.
In debug environment - it is located in the deploy/tomcat/conf/app-core folder (for CUBA versions up to 7.1).