----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

This code:

file =
getServletConfig().getServletContext().getRealPath("/WEB-INF/pool.
cfg");

returns /opt/tomcat/webapps/soporte for me.

My configuration is Apache 1.3.12+SSL+Tomcat 3.1b on Linux SuSe 6.3

Juan Alvarez Ferrando


Corey Wineman wrote:
> 
> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files.  Don't make us guess your problem!!!
> ----------------------------------------------------------------
> 
> Nope,  still returns null.
> 
> > Try with absolute path:
> >
> > getRealPath("/my_servlet")
> >
> > This will probably return:
> >
> > /path/to/tomcat/installation/webapps/your_app/my_servlet
> >
> >
> > Juan Alvarez Ferrando
> >
> > Corey Wineman wrote:
> > >
> > > ----------------------------------------------------------------
> > > BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> > > WHEN YOU POST, include all relevant version numbers, log files,
> > > and configuration files.  Don't make us guess your problem!!!
> > > ----------------------------------------------------------------
> > >
> > > Hello,
> > >
> > > I'm new to Apache and JServ, but I didn't see anything that seemed to
> answer
> > > this on the faq. When running servlets using other webservers, the value
> > > returned from ServletContext's getRealPath() method  was usually the
> > > document root.
> > >
> > > ex:
> > > String realPath = getServletContext().getRealPath( "my_servlet" );
> > > realPath would contain the String: "C:\webserver\htdocs\my_servlet" or
> > > something similar. Then I could organize any files needed by the servlet
> > > based on this path.
> > >
> > > When I run the same servlets with ApacheJserv, I always get null
> instead. I
> > > know that the real path is actually relative to where you ran Jserv. Is
> > > there anyway to configure it so that getRealPath() will return this
> path?
> > > Even better, is there a way to configure things so that getRealPath()
> will
> > > return a path that you specify, say the document root. I know that you
> can
> > > get the document root through the org.apache.jserv.DOCUMENT_ROOT
> variable.
> > > Is there another way to get the value of the document root without
> > > hard-coding any variables into my java code.
> > >
> > > I am not doing anything special in my configuration files (that might be
> the
> > > problem) and used most of the defaults. I think the only significant
> thing I
> > > changed was to add the lines:
> > > wrapper.env.copy=classpath
> > > wrapper.env.copy=path
> > > to jserv.properties so that it could see my servlet classes.
> > >
> > > System:
> > > Win NT
> > > Apache 1.3.12
> > > JSDK2.0
> > > JServ1.1.1
> > > JDK122
> > >
> > > Thanks,
> > > Corey
> > >
> > > --
> > > --------------------------------------------------------------
> > > Please read the FAQ! <http://java.apache.org/faq/>
> > > To subscribe:        [EMAIL PROTECTED]
> > > To unsubscribe:      [EMAIL PROTECTED]
> > > Archives and Other:  <http://java.apache.org/main/mail.html>
> > > Problems?:           [EMAIL PROTECTED]
> >
> >
> > --
> > --------------------------------------------------------------
> > Please read the FAQ! <http://java.apache.org/faq/>
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > Archives and Other:  <http://java.apache.org/main/mail.html>
> > Problems?:           [EMAIL PROTECTED]
> >
> 
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to