Hi.
 
This must be a newbie question but I haven't found how to resolve it.
 
I'm using Windows, Tomcat 5.5 and Axis 1.3.
 
I want to read (and write) files that are in directories not included in the 
classpath.
 
The following method to read a file and returning the contents into a String:
 
    public static String readFile2String(String file) throws Exception {        
String content = null;        FileInputStream fis = null;        try {          
  fis = new FileInputStream(file);            int x = fis.available();          
  byte b[] = new byte[x];            fis.read(b);            content = new 
String(b);        } finally {            if (fis != null) {                
fis.close();            }        }        return content;    }
 
works with these calling lines in a standalone program:
 
    public static void main(String[] args) throws Exception {        
System.out.println("FILE CONTENTS=" + 
readFile2String("W:\\tests\\data\\fich00.dat"));    }
However, when executed 
 
   readFile2String("W:\\tests\\data\\fich00.dat")
 
within the web service, it generates "java.io.FileNotFoundException".
 
Must I configure anything in Tomcat and/or Axis2 to access any file or 
directory?
 
NOTE: I do NOT want to include those files into "lib" or "classes" directory, 
and how the files are not
in the classpath, getClassLoader().getResource() o getResourceAsStream I know 
doesn't work.
 
Thanks in advance,
 
Janfry
 
_________________________________________________________________
Tecnología, moda, motor, viajes,…suscríbete a nuestros boletines para estar 
siempre a la última
Guapos y guapas, clips musicales y estrenos de cine. 

Reply via email to