[ODLPARENT-114] Binding to IP in jetty results in extra connector which causes ODL REST not to respond Created: 13/Sep/17  Updated: 24/Jan/18  Resolved: 19/Sep/17

Status: Resolved
Project: odlparent
Component/s: General
Affects Version/s: 2.0.5
Fix Version/s: None

Type: Bug
Reporter: Tim Rozet Assignee: Stephen Kitt
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File jetty.xml     Zip Archive karaf.zip    
External issue ID: 9158

 Description   

When modifying the jetty connectors to bind to a specific IP and port, the ports seem to bind correctly. However a 3rd connector is brought up (which is not defined in jetty.xml) called "default" that fails to bind. After this, the ports are bound but curling them results in no response. There are more execptions thrown as well around binding. Will attach full jetty.xml and karaf log.

2017-09-13 20:25:00,996 | INFO | onfig-1-thread-1 | JettyServerImpl | 396 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | Pax Web available at [192.0.2.9]:[8181]
2017-09-13 20:25:00,996 | INFO | onfig-1-thread-1 | JettyServerImpl | 396 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | Pax Web available at [192.0.2.9]:[8081]
2017-09-13 20:25:00,996 | INFO | onfig-1-thread-1 | JettyFactoryImpl | 396 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | SPDY not available, creating standard ServerConnector for Http
2017-09-13 20:25:00,997 | INFO | onfig-1-thread-1 | JettyServerImpl | 396 - org.ops4j.pax.web.pax-web-jetty - 4.3.0 | Pax Web available at [0.0.0.0]:[8181]

2017-09-13 20:25:15,658 | INFO | pool-2-thread-1 | ServerConnector | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started jetty-default@5c4c7169

{HTTP/1.1}{192.0.2.9:8181}
2017-09-13 20:25:15,665 | INFO | pool-2-thread-1 | ServerConnector | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started jetty-legacy@31dbf2a5{HTTP/1.1} {192.0.2.9:8081}

2017-09-13 20:25:15,667 | WARN | pool-2-thread-1 | AbstractLifeCycle | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | FAILED default@46a53a87

{HTTP/1.1} {0.0.0.0:8181}

: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)[:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:433)[:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:425)[:1.8.0_141]



 Comments   
Comment by Tim Rozet [ 13/Sep/17 ]

Attachment jetty.xml has been added with description: jetty config

Comment by Tim Rozet [ 13/Sep/17 ]

Attachment karaf.zip has been added with description: karaf log

Comment by Stephen Kitt [ 14/Sep/17 ]

Can you try

<Set name="host">
<Property name="jetty.host" default="192.0.2.9"/>
</Set>

instead of

<Set name="host">192.0.2.9
</Set>

The jetty.host declaration means we're supposed to be able to specify it "somewhere else", I haven't figured out where yet...

Comment by Tim Rozet [ 14/Sep/17 ]

(In reply to Stephen Kitt from comment #3)
> Can you try
>
> <Set name="host">
> <Property name="jetty.host" default="192.0.2.9"/>
> </Set>
>
> instead of
>
> <Set name="host">192.0.2.9
> </Set>
>
> The jetty.host declaration means we're supposed to be able to specify it
> "somewhere else", I haven't figured out where yet...

Hi I tried:
<Set name="host">
<Property name="jetty.host" default="192.0.2.9"/>
</Set>

2017-09-14 14:36:59,906 | INFO | pool-2-thread-1 | ServerConnector | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started jetty-default@79814611

{HTTP/1.1}{192.0.2.9:8181}
2017-09-14 14:36:59,944 | INFO | pool-2-thread-1 | ServerConnector | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started jetty-legacy@73fafbce{HTTP/1.1} {192.0.2.9:8081}

2017-09-14 14:36:59,955 | INFO | rint Extender: 1 | SouthboundProvider | 363 - org.opendaylight.ovsdb.southbound-impl - 1.5.0 | SouthboundProvider ovsdbConnectionService Initialized
2017-09-14 14:36:59,965 | INFO | rint Extender: 1 | SouthboundProvider | 363 - org.opendaylight.ovsdb.southbound-impl - 1.5.0 | SouthboundProvider Session Initiated
2017-09-14 14:36:59,945 | WARN | pool-2-thread-1 | AbstractLifeCycle | 150 - org.eclipse.jetty.util - 9.2.19.v20160908 | FAILED default@6df34902

{HTTP/1.1} {0.0.0.0:8181}

: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)[:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:433)[:1.8.0_141]
at sun.nio.ch.Net.bind(Net.java:425)[:1.8.0_141]

Comment by Stephen Kitt [ 19/Sep/17 ]

It turns out in current Pax Web (at least, the version used in Karaf 4.0.9), the embedded server combines connectors set up in jetty.xml and in org.ops4j.pax.web.cfg. When it finds matching connectors in both, it edits them, otherwise it adds them.

Thus to reconfigure the existing connectors, both files need to be edited.

In jetty.xml, replace both <Property name="jetty.host"/> with <Property name="jetty.host" default="192.0.2.9"/>. In org.ops4j.pax.web.cfg, add a line saying

org.ops4j.pax.web.listening.addresses = 192.0.2.9

With this configuration in place, the embedded server will match the connectors from its configuration file with those from the XML file, and only start the two connectors mentioned there.

Generated at Wed Feb 07 20:27:40 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.