unix - Reading properties file (WildFly on Unx) -


i have problem reading properties file on unix machine. working fine on windows.

more details:

  • wildflie 8 server,
  • application ear file,
  • properties file , java class in same package,
  • properties , java class in war file in ear file.

the code below contains 2 methods both working correct on windows none of them working on unix. why?

package com.mycode.utils;  import java.io.ioexception; import java.io.inputstream; import java.util.properties; import java.util.resourcebundle; import org.apache.log4j.logger;  public class loadmessageproperty {      public static final string message = "messages.properties";      private static final logger logger = org.apache.log4j.logger.getlogger(loadmessageproperty.class.getname());      public string getmessage(string key) {         logger.debug("getmessage(key["+key+"]) begin");         string value = null;         properties prop = new properties();         inputstream input = null;          try {              input = this.getclass().getresourceasstream(message);             if (input == null) {                 system.out.println("sorry, unable find " + message);             } else {                 prop.load(input);                 value = prop.getproperty(key);             }         } catch (ioexception ex) {             logger.error(ex);         } {             if (input != null) {                 try {                     input.close();                 } catch (ioexception e) {                     logger.error(e);                 }             }         }          logger.debug("getmessage(key["+key+"]) end");         return value;     }      public string getmessagebundle(string key){         resourcebundle properties;         string value = "";         properties = resourcebundle.getbundle("com.mycode.utils.messages");         value = properties.getstring(key);         return value;     } } 

ok, figure out. needed add

<resources>     <resource>         <directory>src</directory>             <excludes>               <exclude>**/*.java</exclude>             </excludes>     </resource>          </resources> 

to pom.xml


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -