简体   繁体   中英

Jetty HTTP server ip and port binding error: ServiceConstructionException

[eclipse-jetty] Could not start Jetty server on port 9,091: Cannot assign requested address

I am using jetty HTTP server to publish REST Web Services.

Configurations: server-ip : 20.121.21.22 port: 8081

For above configuration, it throws below exception.

org.apache.cxf.service.factory.ServiceConstructionException

Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 8,081: Cannot assign requested address at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:386) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:178) at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:48) at org.apache.cxf.binding.AbstractBaseBindingFactory.addListener(AbstractBaseBindingFactory.java:95) at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131) at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:192) ... 3 more Caused by: java.net.BindException: Cannot assign requested address at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectC hannelConnector.java:209) at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:289) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) at org.eclipse.jetty.server.Server.doStart(Server.java:253) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55) at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:375) ... 8 more

In Error Message port showing is 8,081 but i have configured is 8081.

Can anyone help with this?

This happens only when IP specified is not own interface. Socket is not able to bind to that IP, Actually error is correct but error message is wrong because it shows wrong port in message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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