tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Gordon <>
Subject Classpath issues with Embedded Tomcat 7
Date Thu, 19 Apr 2012 17:46:29 GMT

By adding all my jars in WEB-INF/lib to my launch command classpath, I can
get the embedded server to run, but this does not seem correct as then what
would be the point of WEB-INF/lib?


I've been unable to find any decent documentation on how to use Embedded
Tomcat so I've been winging it.  The issue I'm having is that from what
I've gleaned from the web all I *should* need in my classpath for my main
method is my main class, tomcat-embed-core.jar,
tomcat-embed-logging.juli.jar, tomcat-embed-jasper.jar, and ecj.jar but I'm
finding that when trying to launch my main from the command line I keep
having to append more and more jars from WEB-INF/lib to my classpath to get
it to continue to try and start up because it keeps spitting out
NoClassDefFoundErrors.  I was under the impression that it would use
WEB-INF/lib for the web app's  classpath but this is not what's happening.
 The syntax used below was used from,
see the section for running a web application.

Here's my main:

public static void main(String[] args)
   throws LifecycleException, InterruptedException, ServletException {

   Tomcat tomcat = new Tomcat();

   File docBase = new File("/usr/local/foo/foo-ui");
   tomcat.addWebapp(null, "", docBase.getAbsolutePath());


and here's my launch command:

user@host: /usr/local/foo/foo-ui
$ java -cp

Anyone have any ideas what I'm doing wrong?  Thanks.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message