Hi Jacob, 1.) 1.000 thanks - this was the answer I needed. Do you know where this is to be found in the docs??? I spent quite some time with searching this forum and the internet, but didn't find any recommendation like that you just gave me.
2.) I see context.getAttribute("javax.servlet.context.tempdir") returns the directory the application is living at. Is it ok to access the file system using ========= String mydir = (String)context.getAttribute("javax.servlet.context.tempdir"); FileInputStream fin = new FileInputStream(mydir + "/WEB-INF/myconfig.txt"); ========= ? or is it more preferable to use ========= Class myclass = this; FileInputStream fin = (FileInputStream)myclass.getResourceAsStream("WEB-INF/myconfig.txt"); ========= ? pls give me a hint which type of access is more portable? Do you also know a howto how to create portable web-applications? thx a lot Johannes Jacob Kjome <[EMAIL PROTECTED]> 28.03.2003 20:27 Please respond to "Tomcat Users List" <[EMAIL PROTECTED]> To "Tomcat Users List" <[EMAIL PROTECTED]> cc Subject Re: Living without a Context - deploying an application using manager app What do you mean "Living without a Context"? Do you mean "living without a Tomcat <Context ...> entry"? All you have to do is add META-INF/context.xml (the name "context.xml" is important so don't name it something else) to your .war file. context.xml is the context configuration file for the context and contains a single <Context ...> element and any nested elements that the <Context ...> element supports. A sample context.xml might look like... <Context path="/arbitraypath" docBase="dbadmin.war"/> Note that the "path" can be anything you want, but the docBase must be the name of the .war file. I also saw your other message where you said.... <quote> additionaly, an application deployed using the manager app currently returns null if you use servletcontext.getRealPath(); so it's context seems to be quite obfuscated... </quote> This is to be expected. When you deploy your app as a .war file and not a directory structure, you have no file system access. If you are counting of having File IO access to within your webapp, you are creating a non-portable application. The servlet spec does not guarantee any direct file system access to any resource on the server other than the directory path returned by context.getAttribute("javax.servlet.context.tempdir"). there you go. Jake At 07:46 PM 3/28/2003 +0100, you wrote: >hi there, > >here are my findings after some experimentation with the ant deploy task >of the manager app. > >*) a complete application can be easily built into a WAR file using ant >*) this WAR file can be easily deployed using ant deploy task >*) once deployed onto the server, the application is running with the >docbase located somewhere under the manager directory: >ant list >-> produces: >"/dbadmin:running:1:F:\tomcat-4.1.18\work\Standalone\localhost\manager\dbadmin.war" > >*) there the application is living >- without a context >- thus, also without any JNDI resources etc. defined in server.xml for a >context dbadmin with docbase dbadmin. > >Would renaming the docbase to " >F:\tomcat-4.1.18\work\Standalone\localhost\manager\dbadmin.war" resolve >the problem of not having any context? >What else could be done to get a context for the webapplication "dbadmin"? > >thx >Johannes