-
1. Re: Properties
mathewa Feb 4, 2005 11:01 AM (in response to sysuser1)Not sure if you mean for a client application to call a bean within jboss deployed app, such as a jndi.properties file or whether its for your application to gain access to a properties file programatically, such as getClassLoader().getResourceAsStream("??.properties"). but in either case, it just has to reside on the class-path.
-
2. Re: Properties
ahsna_jq Feb 4, 2005 11:01 AM (in response to sysuser1)Hi,
Im also facing same problem, both on tomcat and Jboss. I also cannt load Properties file from Web archive WAR file.
Please reply -
3. Re: Properties
ahsna_jq Feb 4, 2005 11:07 AM (in response to sysuser1)Well, basically Im trying to load property file from my Java class, its not a Servlet but bundled within a WAR file. So I cannt use ServletContext.getResourceAsStream() and GetClass().getResourceAsStream either.
Whenever im trying
File file = new File("db.properties");
Properties prop = new Properties();
prop.load(file);
Its saying FileNotFoundException, coz obviously its trying to loading from wrong path while this path is bundled with WAR. -
4. Re: Properties
jleveille Feb 5, 2005 12:51 PM (in response to sysuser1)Do you have experience loading properties froma file in JBoss 3.x? I have done that a lot and never had trouble. I am sorry to say that I don't have JBoss 4.0 experience so I cannot comment on any differences that arise from the version change.
In 3.x we put properties files in the server/default/conf directory or inside the WAR file in WEB-INF/classes. Both of these locations load using getClass().getResourceAsStream() or by loading a resource bundle using the current class loader's methods.
Is there a server/default/conf folder in JBoss 4? Have you tried WEB-INF/classes?