[jboss-user] Classpath not finding properties files via getResourceAsStream in an EJB jar?
Dave Belfer-Shevett
dbs at stonekeep.com
Fri Sep 8 13:01:11 EDT 2006
Hi folks, this one is driving me nutso.
I'm using getResourceAsStream to load a properties file in a deployed
EJB. I've added the properties file into the root of the jar (see
below), and tried to load it. The root of the jar -should- be right on
the classpath, therefore shoudl be loadable. Other Java folks have
said this is proper, not sure why JBoss is not doing it.
JBoss 4.0.4-GA...
The class looks like:
final static String settingsFile = "jena-config.properties";
public static Properties properties ;
public static void loadSettings() {
[...]
Object o=new Object();
properties.load(o.getClass().getResourceAsStream(settingsFile));
[...]
The jar file has:
dbs at yawl:~/workspace/JENA/dist$ jar tvf JENA-ejb.jar
[...]
248 Fri Sep 08 10:44:22 EDT 2006 com/areteinc/ejb3/XMLFetcher.class
1433 Fri Sep 08 11:01:18 EDT 2006
com/areteinc/ejb3/XMLFetcherBean.class
55 Thu Sep 07 12:01:42 EDT 2006 jena-config.properties
[...]
Constantly throws NullPointerException. No matter how I configure the
settingsFile (preceeding '/', etc).
Help? What am I missing here?
-dbs
--
Dave Belfer-Shevett
dbs at stonekeep.com
More information about the jboss-user
mailing list