简体   繁体   English

嵌入Togglz Jetty9

[英]Togglz jetty9 embeded

How to run togglz with jetty 9 embeded. 如何在嵌入了码头9的情况下运行togglz。 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 我有追踪错误

oejucomponent.AbstractLifeCycle - FAILED oejsServletContextHandler@6195bb34{/,null,STARTING}: java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. oejucomponent.AbstractLifeCycle-失败oejsServletContextHandler @ 6195bb34 {/,null,STARTING}:java.lang.IllegalStateException:找不到TogglzConfig或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. 请确保已将所需的集成模块添加到项目中,或按照文档的“配置”一章中的说明在web.xml中注册实现。 java.lang.IllegalStateException: Could not find any implementation of TogglzConfig or TogglzBootstrap. java.lang.IllegalStateException:找不到TogglzConfig或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. 请确保已将所需的集成模块添加到项目中,或按照文档的“配置”一章中的说明在web.xml中注册实现。

I think you should set org.togglz.FEATURE_MANAGER_PROVIDED to false instead. 我认为您应该将org.togglz.FEATURE_MANAGER_PROVIDED设置为false 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. 将其设置为true告诉Togglz,它不应使用TogglzConfig实现来引导FeatureManager,而是尝试使用IoC容器(例如Spring或CDI)提供的FeatureManager。

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 . 顺便说一句:您还应该将TogglzFilter的映射更改为/*以便Togglz适用于所有请求,而不仅适用于以/togglz开头的URL请求。

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. 您需要在ServletContextHandler而不是ServletHolder上设置init参数。 Then everything is working fine. 然后一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM