从码头8转移到码头9后,ProxyServlet停止工作 [英] ProxyServlet stop working after migration from jetty 8 to jetty 9

查看:512
本文介绍了从码头8转移到码头9后,ProxyServlet停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个eclipse插件,它使用代理服务器与ProxyServlet。基本上,实现如下:

  ServletHolder proxyServletHolder = new ServletHolder(new SubClassOfProxyServlet()); 
proxyServletHolder.setAsyncSupported(true);
ServletHandler proxyServletHandler = new ServletHandler();
proxyServletHandler.addServletWithMapping(proxyServletHolder,/ mapping / url);在此之后,我将代理处理程序添加到处理程序列表中,并将此列表设置为服务器:


>

  HandlerList handlers = new HandlerList(); 
handlers.setHandlers(new Handler [] {
。//其他处理程序

proxyServletHandler,



new DefaultHandler()
});
server.setHandler(处理程序);

一切都像一个魅力反对 jetty 8 ,但迁移到 jetty 9 我收到以下错误:



导致:java.lang.IllegalStateException:代理服务器执行者
在org.eclipse.jetty.proxy.ProxyServlet.createHttpClient(ProxyServlet.java:279)
在org.eclipse.jetty.proxy.ProxyServlet.init(ProxyServlet.java:123)
.. 。另外24个



使用ProxyServer的机制有所改变吗?我错过了什么?

解决方案

您需要更新您的 SubClassOfProxyServlet 包括现在从服务器传递给代理的各种配置,然后由内部 HttpClient



特定的错误意味着您不会正确地传递执行程序。



您有两个选择执行者的具体部分(在解决此问题后可能会有更多的事情要配置)


  1. 设置init参数 maxThreads 到一个有效的整数值。

  2. 或创建一个Executor,并将其设置在servlet上下文属性 ServletContext.setAttribute (org.eclipse.jetty.server.Executor,myExecutor)在应用程序部署/启动。 - 您可以在 SubClassOfProxyServlet.init(ServletConfig config)方法中执行此操作。


I have an eclipse plugin which uses jetty server with ProxyServlet. Basically, the implementation is the following:

    ServletHolder proxyServletHolder = new ServletHolder(new SubClassOfProxyServlet()); 
    proxyServletHolder.setAsyncSupported(true);
    ServletHandler proxyServletHandler = new ServletHandler();
    proxyServletHandler.addServletWithMapping(proxyServletHolder, "/mapping/url");

After that I add proxy handler to the handler list and set this list to the server:

    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] {
            . // Other Handlers
            .
            proxyServletHandler,
            .
            .
            .
            new DefaultHandler()
        });
    server.setHandler(handlers);

Everything worked like a charm against jetty 8 but after migration to jetty 9 I get the following error:

Caused by: java.lang.IllegalStateException: No server executor for proxy at org.eclipse.jetty.proxy.ProxyServlet.createHttpClient(ProxyServlet.java:279) at org.eclipse.jetty.proxy.ProxyServlet.init(ProxyServlet.java:123) ... 24 more

Has the mechanism of working with ProxyServer changed? Am I missing something?

解决方案

You need to update your SubClassOfProxyServlet class to include the various configurations that are now being passed from the Server to the Proxy which are then in turn used by the internal HttpClient

The particular error means you are not passing along the Executor properly.

You have 2 choices for the Executor specific piece (there might be more things for you to configure after this is addressed)

  1. Set the init-parameter maxThreads to a valid integer value.
  2. or Create an Executor, and set it in the servlet context attributes at ServletContext.setAttribute("org.eclipse.jetty.server.Executor", myExecutor) on application deployment / startup. - You could probably do this as well in your SubClassOfProxyServlet.init(ServletConfig config) method.

这篇关于从码头8转移到码头9后,ProxyServlet停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆