Togglz jetty9 embeded

1.1k Views Asked by At

How to run togglz with jetty 9 embeded. I tryed with follow code

        ServletHolder togglz = new ServletHolder(TogglzConsoleServlet.class);
        togglz.setInitParameter("org.togglz.core.manager.TogglzConfig", "com.citronium.togglz.config.PlansteryTogglzConfig");
        togglz.setInitParameter("org.togglz.FEATURE_MANAGER_PROVIDED", "true");
        context.addServlet(togglz, "/togglz/*");
        EnumSet<DispatcherType> all = EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.FORWARD,
                DispatcherType.INCLUDE, DispatcherType.REQUEST);
        context.addFilter(new FilterHolder(new TogglzFilter()), "/togglz/*", all);

I have follow error

o.e.j.u.component.AbstractLifeCycle - FAILED o.e.j.s.ServletContextHandler@6195bb34{/,null,STARTING}: java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. Please make sure that you have added the required integration modules to your project or register the implementation in your web.xml as described in the 'Configuration' chapter of the documentation. java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. Please make sure that you have added the required integration modules to your project or register the implementation in your web.xml as described in the 'Configuration' chapter of the documentation.

2

There are 2 best solutions below

3
On

I think you should set org.togglz.FEATURE_MANAGER_PROVIDED to false instead. Setting it to true tells Togglz that it should NOT bootstrap a FeatureManager using your TogglzConfig implementation and instead try to use a FeatureManager provided by a IoC container like Spring or CDI.

BTW: You should also change the mapping for the TogglzFilter to /* so that Togglz works for all requests and not just for requests for URLs starting with /togglz.

0
On

I know this prob is old, but since I ran into the same problem I want to share the solution.

You need to set the init params on your ServletContextHandler not on you ServletHolder. Then everything is working fine.