tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Configuring embedded Tomcat with @WebServlet annotations
Date Sat, 09 Mar 2019 19:45:09 GMT
On 08/03/2019 17:47, Raffaele Sgarro wrote:
> Hello all! How is one supposed to configure Tomcat (I'm on 9.x) to scan a
> given package looking for @WebServlet servlets?
> I cannot find any API and relevant examples in the Tomcat source.
> More insight: my app is currently packaged as a WAR and deployed to a
> running Tomcat instance. I want to build a fat JAR and starting Tomcat in
> my main() - but then I do not have any WAR/JAR because all classes are on
> classpath. Is there some utility in Tomcat? Is there any external library
> commonly used for this?

Scanning for annotations (and various other bits and pieces) is
controlled by the JarScanner component.

You might need to set scanBootstrapClassPath="true" depending on exactly
how your far JAR is packaged / structured.

Another option is to use logEffectiveWebXml on the Context to create the
equivalent web.xml and then use that.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message