I have created two OSGI bundles A and B using the eclipse Plug-in project wizard (using eclipse Helios).
In the manifest file of bundle B I have added bundle A as a dependency. Further I have exported the packages in A so they are visible for B. I also have a .properties file in bundle A that I would like to make visible for bundle B. In the build.properties pane in bundle A I have specified:
source.. = src/
bin.includes = META-INF/,\
.,\
bundle_A.properties
Now in bundle B I try to load the .properties file using:
private Properties loadProperties() {
Properties properties = new Properties();
InputStream istream = this.getClass().getClassLoader().getResourceAsStream(
"bundle_A.properties");
try {
properties.load(istream);
} catch (IOException e) {
logger.error("Properties file not found!", e);
}
return properties;
}
But that gives a nullpointer exception (the file is not found on the classpath).
Is it possible to export resources from bundle A (just like when you export packages) or somehow access the file in A from B in another way (accessing the classloader for bundle A from bundle B)?