Here is the thing that worked for me on pier 9.
Server server = new Server(8080); WebAppContext webAppContext = new WebAppContext(); webAppContext.setResourceBase("src/main/webapp"); webAppContext.setContextPath("/"); webAppContext.setConfigurations(new Configuration[] { new WebXmlConfiguration(), new AnnotationConfiguration() { @Override public void preConfigure(WebAppContext context) { ClassInheritanceMap map = new ClassInheritanceMap(); map.put(WebApplicationInitializer.class.getName(), new ConcurrentHashSet<String>() {{add(WebApplication.class.getName());}}); context.setAttribute(CLASS_INHERITANCE_MAP, map); _classInheritanceHandler = new ClassInheritanceHandler(map); } } }); server.setHandler(webAppContext); server.start();
For berth 8, this may work:
webAppContext.setConfigurations(new Configuration[] { new WebXmlConfiguration(), new AnnotationConfiguration() { @Override public void preConfigure(WebAppContext context) throws Exception { MultiMap<String> map = new MultiMap<String>(); map.add(WebApplicationInitializer.class.getName(), MyWebApplicationInitializerImpl.class.getName()); context.setAttribute(CLASS_INHERITANCE_MAP, map); _classInheritanceHandler = new ClassInheritanceHandler(map); } } });
MultiMap is one form of the org.eclipse.jetty.util package
source share