You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org> on 2017/02/27 15:08:46 UTC
[jira] [Closed] (CXF-7179) Unable to set ServerConnector in
JettyHTTPServerEngine using jetty 9
[ https://issues.apache.org/jira/browse/CXF-7179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Colm O hEigeartaigh closed CXF-7179.
------------------------------------
> Unable to set ServerConnector in JettyHTTPServerEngine using jetty 9
> --------------------------------------------------------------------
>
> Key: CXF-7179
> URL: https://issues.apache.org/jira/browse/CXF-7179
> Project: CXF
> Issue Type: Bug
> Components: Transports
> Affects Versions: 3.1.9
> Reporter: Michael Austermann
> Assignee: Freeman Fang
> Fix For: 3.2.0, 3.1.10
>
>
> With Jetty 9 a reference to the jetty server is needed to create a ServerConnector (jetty's default connector).
> See org.eclipse.jetty.server.ServerConnector.ServerConnector(Server)
> Using the CXF JettyHTTPServerEngineFactory and JettyHTTPServerEngine to create a jetty server, it is impossible to override the Connector.
> The method org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.setConnector(Connector) is useless, because it is impossible to create a ServerConnector without a Jetty Server and JettyHTTPServerEngine.getServer() returns null during configuration phase of the JettyHTTPServerEngine.
> The example below leads to a NullPointerException:
> {noformat}
> public class Example {
> public static void main(String[] args) throws Exception {
> JettyHTTPServerEngineFactory factory = new JettyHTTPServerEngineFactory();
> JettyHTTPServerEngine engine = factory.createJettyHTTPServerEngine(12345, "http");
> ServerConnector connector = new ServerConnector(null); // engine.getServer() is also NULL at this time
> engine.setConnector(connector);
> Provider provider = Provider.provider();
> EndpointImpl epi = (EndpointImpl) provider.createEndpoint(null, new FooImpl());
> epi.publish("http://0.0.0.0:12345/foo");
> }
> }
> {noformat}
> {noformat}
> Exception in thread "main" java.lang.NullPointerException
> at org.eclipse.jetty.server.AbstractConnector.<init>(AbstractConnector.java:170)
> at org.eclipse.jetty.server.AbstractNetworkConnector.<init>(AbstractNetworkConnector.java:44)
> at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:227)
> at org.eclipse.jetty.server.ServerConnector.<init>(ServerConnector.java:96)
> at Example.main(Example.java:14)
> {noformat}
>
>
> Class JettyHTTPServerEngine needs to be adapted to enable setting a custom jetty 9 connector.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)