I have tried all the following combinations
Code:
String[] paths = { "applicationContext.xml" };
String[] paths = { "/applicationContext.xml" };
String[] paths = { "config/applicationContext.xml" };
String[] paths = { "/config/applicationContext.xml" };
But always I get a file not found exception.
As I said in my standalone application, If I put
Code:
String[] paths = { "applicationContext.xml" };
the file is in config folder which is in my class path, it is working fine.
I have to put "config/" for the file name in my resource manager. For example for loading images from my icons/ folder I am using the following code and it works.
Code:
ResourceManager.getPuginURL("icons/open.gif");
If I by pass spring and load Hibernate directly by using the following code I am able to load hibernate.cfg.xml
Code:
.......
cfg.configure("/hibernate.cfg.xml");
both of these and other config files are in the same config/ folder.
I tried loading log4j.xml using my resource manager by specifying
Code:
ResourceManager.getPuginURL("config/log4j.xml");
it loads correctly and DOMConfigurator is initialized.
This is the standard method provided by SWTDesigner tool.
Code:
public static URL getPluginURL(String relativePath) throws Exception {
Bundle bundle = Platform.getBundle("myapp");
String newPath = relativePath;
if (relativePath.length() > 0 && relativePath.charAt(0) == '/')
newPath = relativePath.substring(1, relativePath.length());
Path path = new Path(newPath);
URL fileURL = Platform.find(bundle, path);
return fileURL;
}