0

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.

Rinat Mukhamedgaliev
  • 5,401
  • 8
  • 41
  • 59
  • How did you managed to solve this problem? I'm running at the same issue and nothing seems to solve it =/ – Marcelo Apr 29 '14 at 01:50

2 Answers2

1

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.

chkal
  • 5,598
  • 21
  • 26
  • not work. Can you show example to start togglz with jetty9 emdeded? i try use jetty without xml. – Rinat Mukhamedgaliev Aug 28 '13 at 15:30
  • I'm the creator of Togglz, but I don't know much about embedded jetty. But if you create a minimal example that reproduces this, I could have a look at it. But I think the togglz-users group is a better place to help you with this: https://groups.google.com/forum/?fromgroups#!forum/togglz-users – chkal Aug 29 '13 at 20:47
  • And also: You should only use DispatcherType.REQUEST for the TogglzFilter. – chkal Sep 04 '13 at 13:31
0

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.

Catscratch
  • 699
  • 1
  • 8
  • 16