In domain mode , I am able to use properties file as a module but the problem is if there is any modification in the file then i'l need to do it for all slaves in the domain. I want to centralize the file so that at one point I can change and it will be reflected on all slaves.
I know in domain.xml we can configure global level system properties but I have around 25 properties files.
So is there a way to centralized the files??
myjar.jar
-->package
--> class
-->properties
-->xml files
myjar.jar is an archived jar file To fetch the xml files
URL url = Thread.currentThread().getContextClassLoader().getResource("./properties");
File queryFolder = new File(url.getFile());
for (File fileName : queryFolder.listFiles()) // null pointer exception
{
if (fileName.getName().toUpperCase().endsWith("XML"))
{
saxParser.parse(fileName, this);
}
}
This is not working.
Tried this
How do I list the files inside a JAR file?
And facing the same problem given in below link
JBoss wildfly 8.x Provider "vfs" not installed when using java nio Paths
URL w_url = mmyClass.class.getProtectionDomain().getCodeSource().getLocation();
JarEntry w_ze = null;
LOGGER.info("Jar******************" + w_url.toString());
if (w_url.toString().endsWith(".jar"))
{
try (JarInputStream jar = new JarInputStream(w_url.openStream()))
{
while ((w_ze = jar.getNextJarEntry()) != null)
{
LOGGER.info("Name *******" + w_ze.getName());
}
}
catch(Exception e)
{
}
}
Added properties folder inside a war file and fetched the exploded folder path using below code in the servlet of the war file.
config.getServletContext().getRealPath("/");
This gives the vfs path of the folder.
and configured the same in
System.setProperty("REALPATH", config.getServletContext().getRealPath("/"));
and used the same in the jar file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With