Hi, I am unable to get anything when I use "this.getResourceAsStream". I am getting java.lang.NullPointerException. I extended the service class with ClassLoader. Please tell me if their is any other way.
Steve Hall-5 wrote: > > Joern, > > I'm not sure how you are deploying your web service. However, if it is > in a webapp (like the axis2 webapp), then place the properties file in > the WEB-INF/classes directory and use the following code. > > > // Read properties file. > Properties properties = new Properties(); > try > { > properties.load(this.getResourceAsStream("axis.properties")); > } > catch (IOException e) > { > logger.error("Cannot locate axis.properties file", e); > } > > Steve Hall > > > joern.albin...@gmx.de wrote: >> Hello, >> >> I have a problem with my properties class. After archiving my service >> my database controller can't locate or read the properties data. >> In the data are the settings for the database connection like treiber >> , username url . >> Where do I have to place the properties for the right reading and is >> it possible to use a normal properties like this: >> >> ** >> >> *private* *boolean* loadProperties() { >> >> *boolean* data = *false*; >> >> *try* { >> >> /properties/.load(*new* FileInputStream(config)); >> >> data = *true*; >> >> } *catch* (*final* FileNotFoundException e) { >> >> System./out/.println("Config File konnte nicht gefunden weren oder >> existiert nicht."); >> >> data = *false*; >> >> e.printStackTrace(); >> >> } *catch* (*final* IOException e) { >> >> System./out/.println("Es ist ein Fehler beim Lesen der Config Datei >> aufgetreten."); >> >> data = *false*; >> >> e.printStackTrace(); >> >> } >> >> *return* data; >> >> }// end of load Properties >> >> >> >> I hope , that someone can help with this problem. >> >> >> Best regards >> Jörn > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: axis-user-unsubscr...@ws.apache.org > For additional commands, e-mail: axis-user-h...@ws.apache.org > > > -- View this message in context: http://www.nabble.com/Axis2-with-Properties-tp18629263p25060071.html Sent from the Axis - User mailing list archive at Nabble.com.