E ai galera?!
Seguinte:
Eu criei um projeto do tomcat no eclipse e numa das minhas classes eu precisava ler um arquivo .properties , quando eu chamo essa classe fora do tomcat eu consigo ler o . properties numa boa, mas quando eu acesso numa página jsp dá pau:
a minha classe segue abaixo:
public class ConnectionFactory {
ConnectionFactory() {
}
public Connection getConnection(String banco) throws Exception {
Properties properties = getProperties();
Connection conn = null;
String pre = banco;
String driver = properties.getProperty(pre + ".connection.driver").trim();
Class driverClass = Class.forName(driver);
String url = properties.getProperty(pre + ".connection.url").trim();
String user = properties.getProperty(pre + ".connection.user").trim();
String pass = properties.getProperty(pre + ".connection.password").trim();
DriverManager.registerDriver((Driver) driverClass.newInstance());
conn = DriverManager.getConnection(url, user, pass);
return conn;
}
public Properties getProperties() throws IOException {
Properties prop = new Properties();
FileInputStream fis = new FileInputStream("db.properties");
prop.load(fis);
fis.close();
return prop;
}
}
qualquer ajuda é bem vinda…
Valew Galera!