3 Replies Latest reply on Feb 3, 2008 4:06 PM by Oskar Carlstedt

    reading a local properties file

    aodhan hoffman Newbie

      I'm writing a POJO/servlet based JAXWS web service on JBoss 4.0.5 w/ JBossWS 1.2.1. I'm trying to use a properties files located at /WEB-INF/properties.xml but I can't find the file. The only way I can seem to get the web service classes to find the properties file is to use an absolute URI from C: which is totally unworkable for production.

      Using this code:

      if ( !(new File(propertiesPath).exists()) )
       {
       log.fatal("NOT FOUND: " + propertiesPath );
       }
      


      This fails, I've tried variations, but can't seem to find the path:
      public static final String propertiesPath = "properties.xml";

      This works,
      public static final String queriesPath = "C:/Documents and Settings/tx714c/workspace/NlsAssociationService341/WEB-INF/properties.xml";

      and if I assume that '...\workspace' is my local dir, I can use a relative path. But I can't get a path local to the WAR file to work.

      Here's the listing of the war file:
      C:\Documents and Settings\tx714c\My Documents\workspace\ShimWS3.4.1>jar -tf gen\NlsAssociationServic
      e341.war
      META-INF/
      META-INF/MANIFEST.MF
      WEB-INF/
      WEB-INF/web.xml
      WEB-INF/classes/
      WEB-INF/classes/com/
      ...
      WEB-INF/classes/org/soapinterop/xsd/ValidationException.class
      WEB-INF/lib/
      ...
      WEB-INF/lib/wsdl4j-1.5.1.jar
      WEB-INF/properties.xml
      WEB-INF/queries.xml
      


      How do I access and load a local properties file from within the war? Thanks!