Hi, I have this pretty straight forward case of starting an instance of tomcat and bringing in a filter.
Tomcat tomcat = new Tomcat(); tomcat.setPort(8080); File base = new File("."); Context ctx = tomcat.addContext("", base.getAbsolutePath()); String filterName = "Default"; FilterDef filterDef = new FilterDef(); filterDef.setFilterName(filterName); filterDef.setFilterClass(DefaultFilter.class.getName()); ctx.addFilterDef(filterDef); FilterMap mapping = new FilterMap(); mapping.setFilterName(filterName); mapping.addURLPattern("/*"); ctx.addFilterMap(mapping); tomcat.start(); tomcat.getServer().await(); Thread.sleep(60000); My filter's pretty boring, but here it is public class DefaultFilter implements Filter{ @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { servletResponse.getWriter().println("Hello, world!"); } @Override public void destroy() { } } When starting this up (Just running in a plain JUnit test), the container is running however making requests to localhost:8080/ just result in 404's. I'd expect my filter to handle those requests. When using a servlet, its perfectly fine. I tried it on both 8.5.4 and 8.0.30. Any ideas? John