You are confusing the WAR structure with the actual .war archive. The .war archive is a .jar format archive. I challenge you to try to use File IO to access a file inside a .jar or .war archive. If you can do it, please let us all know because you will have broken new ground in Java :-)
Remember that Tomcat auto-expands .war files to a directory structure and then deploys the directory structure. Also, you mention that your contextPath points to the "build" *directory*. That is, obviously, not a .war file archive, but a directory structure which will, quite obviously, work to get a real path using File IO. The only way to test serving out of a .war archive in Tomcat is to define a <Context> element with the docBase pointing to a .war archive. For instance...
Assuming the .war file is in CATALINA_HOME/webapps
<Context path="/mypath" docBase="myWarArchive.war"/>
Make sure to stop tomcat before you put the .war file into webapps. Add the above to your server.xml or a context configuration file (like admin.xml or manager.xml are set up). Then put the .war file into webapps. Now start Tomcat. Then, try to access a servlet which uses getRealPath("/"). Check the value. I guarantee it is null.
Jake
At 03:23 PM 1/6/2003 +0100, you wrote:
On Mon, 2003-01-06 at 15:22, Jacob Kjome wrote:
> Check is that is null before using it as it *will* be null if you serve
> your app directly from a .war file rather than from a directory on the file
> system.
Odd, I do serve mine from a .war file, however the contextPath is not
null, but points to the build directory. This is probably not true if
the war is buildt elsewhere than on the local host.
> Jake
Thanks
Øyvind
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>