On Mar 12, 2013, at 10:47 PM, Nick Williams wrote:
> The JavaDoc for o.a.c.startup.Tomcat [1] is not complete. Importantly, it is
> lacking complete information about all three addWebapp classes. Ultimately, I
> want to create one giant JAR file with my classes, Tomcat classes, servlet
> classes, etc., with a com.mycompany.Bootstrap specified as the Main class in
> MANIFEST.MF. Here's (roughly) what I expect it to look like (though, if it
> should be different to make something work correctly, please correct me):
>
> - MyEmbeddedWebApp.jar
> - com
> - mycompany
> - ...
> - javax
> - ...
> - META-INF
> - MANIFEST.MF
> - org
> - apache
> - ...
> - web
> - index.html
> - WEB-INF
> - web.xml
>
> How do I correctly start up Tomcat so that my (lone) web app
> (MyEmbeddedWebApp.jar!/web/WEB-INF/web.xml) is correctly deployed to the root
> context (/) with index.html and etc. resources available?
>
> [1]
> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/startup/Tomcat.html
By the way, com.mycompany.Bootstrap currently looks like the code below. It's
the webAppDirLocation variable and addWebapp method call that I'm struggling
with.
public class Bootstrap
{
public static void main(String... arguments) throws Exception
{
String webAppDirLocation = "web/";
Tomcat tomcat = new Tomcat();
tomcat.setPort(8973);
tomcat.addWebapp("/", new File(webAppDirLocation).getAbsolutePath());
tomcat.start();
tomcat.getServer().await();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]