tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qiao Jin" <bra...@gmail.com>
Subject RE: application.getRealPath() in JSP from a subdirectory
Date Sun, 01 Feb 2009 03:29:28 GMT
Mark, 

Thanks for your help. This makes sense. I misunderstood the meaning of
appBase. getRealPath() is behaving well now, although I will explore the
other options Chuck mentioned. 

Regards,
Qiao

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Friday, January 30, 2009 11:09 PM
To: Tomcat Users List
Subject: Re: application.getRealPath() in JSP from a subdirectory

Qiao Jin wrote:
> Serving mydomain.com, what I have is one application in an unpacked
> directory, 'app-root', with jsp files located in the root dir or its
> subdirs. The Host for mydomain.com has its appBase pointing to 'app-root'.

> 
> The ROOT.xml for mydomain.com has only one line: <Context path=""
docBase=""
> reloadable="true"/>
> 
> I read the document on the two attributes appBase and docBase, but it is
not
> very clear to me what the difference is. In my case, what should docBase
be?

The quickest fix will be:
- stop Tomcat
- delete ROOT.xml
- create a new dir called "ROOT" under app-root
- copy the contents of app-root to app-root/ROOT
- make sure there is no ROOT.xml in CATALINA_BASE/conf/<engine>/<host>
- start Tomcat

Mark

> 
> 
> Thanks and regards,
> Qiao 
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Friday, January 30, 2009 9:23 PM
> To: Tomcat Users List
> Subject: Re: application.getRealPath() in JSP from a subdirectory
> 
> Qiao Jin wrote:
>> Chuck, thanks for your response. It turns out that the auto-deploy switch
>> does affect the situation. New subdirs created after the auto-deploy is
>> turned off are no longer being treated as separate apps and getRealPath
is
>> returning the path as I expected.
> 
> This looks very much like you have configured appBase == docBase for the
> ROOT
> web application. This is likely to cause a world of pain - the behaviour
you
> have seen here being just one example. Try restarting Tomcat and see what
> happens to your getRealPath() calls...
> 
> docBase should never be set to the same location as appBase.
> 
> Mark
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message