2

I need to read a properties file located inside an ear. In jboss 5.1 I put the file in the root of the ear and it works, but in wildfly it doesn´t. In wildfly, I managed to read the property file outside the ear according to this

http://blog.jyore.com/?p=58

But I haven´t found the way to do the same but with the file inside the ear. I´ve tried without success putting the file in the METAINF folder, also tried with the "Class-Path: ." in the manifest...

Please any ideas?? Do I have to put the file in any specific location??

  • You can put the file together with classes and then use `Me.class.getResource(...)`. –  Jun 29 '15 at 14:18
  • Thanks for responding. I don´t have any classes folder, just a lib folder with the jar archives. Do you mean that putting the properties file in a classes folder should work? – César Puente Gail Jun 29 '15 at 14:28
  • If you need to access files from one `.war` then yes, just put them in `WEB-INF/classes`, just as compiled Java code. No idea about accessing from multiple `.war`s though. –  Jun 29 '15 at 14:38
  • No, I don´t have any .war in the .ear, just a few ejb´s deployed. I need to access to the properties from those ejb´s – César Puente Gail Jun 29 '15 at 15:10

1 Answers1

1

I found the solution:

In WildFly 8, to get those properties available in the classpath, package them within your application. For example, if you are deploying a .war then package those properties in WAR WEB-INF/classes/ folder. If you want those properties accessible to all components in a .ear, then package them at the root of some .jar and place that jar in EAR lib/ folder.

https://docs.jboss.org/author/display/WFLY8/How+do+I+migrate+my+application+from+AS5+or+AS6+to+WildFly

Thanks for your help