Re: FileInputStream in Servlet



bauerg@xxxxxxx wrote:
Hi there!
I am not sure to be right here at this forum, but:

I have a servlet, which I want to debug within eclipse.
The servlet is reading a config-file on startup, this file is opend
with a FileInputStream(filename), but without a path!

I have defined the Tomcat4 for MyEclipse with different HOME and BASE,
if I set a fix path (i.e. "c:/file.ext") then everythin works fine, but

without the path, the FileInputStream everytime gives a exception:
java.io.FileNotFoundException: file.ext

I have placed the file.ext in many directories, but it never has been
found!

Where to hell does Tomcat search for this file???

Please could someone help me? Do I have to place the file in
TOMCAT_HOME, TOMCAT_BASE, somwhere under one of this, or what?

thanks in advance Georg

have your tried placing the file in the same location as the class that reads it?

Tim
.



Relevant Pages

  • Re: Novice Tomcat design pattern question
    ... a ServletContextListener to handle the startup. ... Neither does a startup servlet. ... It inherits a couple of do nothing ... I'm a big believer in minimal exposed interfaces. ...
    (comp.lang.java.programmer)
  • Re: Novice Tomcat design pattern question
    ... a ServletContextListener to handle the startup. ... there is also an initand destroy() method on the HttpServlet ... I took a quick glance at the Servlet Specification, ... lawyer in me found at least one potential issue; the servlet container ...
    (comp.lang.java.programmer)
  • Re: starting a weblogic servlet?
    ... > public void init(ServletConfig config) throws ServletException ... >invoked upon servlet startup? ... a servlet on startup. ...
    (comp.lang.java.programmer)
  • Re: Does load-on-startup effect tomcat singleton classloading?
    ... >That jar has a servlet, loaded at startup, which loads a config file ... for a minimal servlet to duplicate ...
    (comp.lang.java.programmer)
  • Re: FileInputStream in Servlet
    ... The servlet is reading a config-file on startup, this file is opend with a FileInputStream, but without a path! ... I have defined the Tomcat4 for MyEclipse with different HOME and BASE, ... somewhere under its own directory hierarchy. ...
    (comp.lang.java.programmer)