String path = ConnPool.class.getPackage().getName().replaceAll("//.", "/")+"/Config.xml";
URL url = null;
try {
if (Thread.currentThread().getContextClassLoader() != null) {
url = Thread.currentThread().getContextClassLoader().getResource(path);
}
if (url == null) {
url = ConnPool2.class.getClassLoader().getResource(path);
}
if(url ==null) {
url = ConnPool2.class.getClassLoader().getResource("/"+path);
}
if(url != null) {
JAXPConfigurator.configure(url.getFile(), false);
}
else{
String strURL = ConnPool2.class.getProtectionDomain().getCodeSource().getLocation().getPath();
strURL += ConnPool.class.getPackage().getName().replaceAll("//.", "/")+"/Config.xml";
JAXPConfigurator.configure(strURL, false);
}
} catch (Exception e) {
try {
InputStream in = ConnPool.class.getResourceAsStream(path);
BufferedReader reader= new BufferedReader(new InputStreamReader(in));
} catch (Exception ex) {
InputStream in = ConnPool.class.getResourceAsStream("/"+path);
BufferedReader reader= new BufferedReader(new InputStreamReader(in));
}
}
try {
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}