Share a properties file between slaves in Wildfly10 domain mode

In domain mode, I can use the properties file as a module, but the problem is whether there is any modification in the file, then I need to do this for all subordinates in the domain. I want to centralize the file so that at some point I can change, and it will be reflected on all subordinates.

I know that in domain.xml we can configure global level system properties, but I have about 25 properties files.

So, is there a way to centralize files?

myjar.jar -->package --> class -->properties -->xml files 

myjar.jar - archived jar file To get 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 does not work.

Tried this

How to list files inside a jar file?

And faced with the same problem 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) { } } 
+5
source share
1 answer

The properties folder inside the war file is added and the path of the exploded folders is selected using the code below in the war file servlet.

 config.getServletContext().getRealPath("/"); 

This gives the path to the vfs folder.

and set up the same thing in

 System.setProperty("REALPATH", config.getServletContext().getRealPath("/")); 

and used the same in the jar file.

+1
source

Source: https://habr.com/ru/post/1270823/


All Articles