Try:

File baseDir = new File(System.getProperty("java.io.tmpdir"));
tomcat.addContext("", baseDir.getAbsolutePath());




2014/1/22 John Cartwright - NOAA Federal <john.c.cartwri...@noaa.gov>

> Thanks for the suggestion Valery, but swapping the arguments doesn't work.
>
> --john
>
>
>
> On Tue, Jan 21, 2014 at 8:12 AM, Valery Shyshkin <vns.shysh...@gmail.com
> >wrote:
>
> > May be tomcat.addWebapp(contextName,pathToWarFile) instead of
> > tomcat.addWebapp(pathToWarFile, contextName) will help yoo.
> >
> >
> > 2014/1/21 John Cartwright - NOAA Federal <john.c.cartwri...@noaa.gov>
> >
> > > Hello All,
> > >
> > > I'm trying to create a very basic embeded tomcat 7 application to host
> a
> > > packed WAR file.  My code looks like:
> > >
> > > Tomcat tomcat = new Tomcat()
> > > tomcat.setPort(port)
> > > tomcat.setBaseDir(".")
> > > tomcat.addWebapp(pathToWarFile, contextName)
> > >
> > > It seems to work, but I'm getting an exception on startup complaining
> > about
> > > the missing webapps directory:
> > >
> > >    SEVERE: Exception fixing docBase for context [/quickstart]
> > >    java.io.IOException: Application base [{1}] for host
> > > [/private/tmp/./webapps] does not exist or is not a directory.
> > >
> > > Can someone please direct me to a better way to do this? Is
> > > Tomcat#addWebapp not appropriate if hosting a packed WAR file?
> > >
> > > Thanks!
> > >
> > > --john
> > >
> >
>

Reply via email to