[
https://issues.apache.org/jira/browse/FELIX-2714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
J.W. Janssen resolved FELIX-2714.
---------------------------------
Resolution: Cannot Reproduce
Please reopen if this is still an issue with the latest snapshot of felix-http.
> Registered servlet throws java.net.ConnectException or returns 404 after
> updating the portnr using Config Admin
> ---------------------------------------------------------------------------------------------------------------
>
> Key: FELIX-2714
> URL: https://issues.apache.org/jira/browse/FELIX-2714
> Project: Felix
> Issue Type: Bug
> Components: HTTP Service
> Affects Versions: http-2.0.4
> Reporter: Ivo Ladage-van Doorn
> Attachments: portswitchtest.zip
>
>
> When the "org.osgi.service.http.port" property is updated using Config Admin,
> without effectively changing it (so setting it to 8080 while the default is
> also 8080), it seems that subsequent servlet registrations fail. A HTTP GET
> to this servlet either results in a java.net.ConnectException: Connection
> refused: connect or it returns a 404. Changing it to any other port number
> results in exactly the same error.
> Attached is a bundle that reproduces the issue, depending on a HttpService
> and ConfigurationAdmin implementation. The issue can be reproduced by using
> the Felix httpservice and Felix config admin deployed on a Felix framework.
> Summarized this is the use case:
> - Start HttpService and wait for it to become available (runs on 8080 by
> default)
> - Update the "org.osgi.service.http.port" to 8080 using Config Admin (so
> effectively nothing is changed)
> - Register a servlet
> - Open a URL connection to this servlet
> Now the very first time, this error appears in the console:
> java.net.ConnectException: Connection refused: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> at java.net.Socket.connect(Socket.java:525)
> at java.net.Socket.connect(Socket.java:475)
> at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
> at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
> at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
> at sun.net.www.http.HttpClient.New(HttpClient.java:306)
> at sun.net.www.http.HttpClient.New(HttpClient.java:323)
> at
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
> at
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
> at
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
> at org.amdatu.test.PortSwitchTest.checkURL(PortSwitchTest.java:86)
> at org.amdatu.test.PortSwitchTest.test(PortSwitchTest.java:50)
> at org.amdatu.test.Activator.addingService(Activator.java:30)
> at
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
> at
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
> at
> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
> at
> org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
> at
> org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
> at
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
> at
> org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
> at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3721)
> at org.apache.felix.framework.Felix.access$000(Felix.java:80)
> at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:717)
> at
> org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
> at org.apache.felix.framework.Felix.registerService(Felix.java:2842)
> at
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
> at
> org.apache.felix.http.base.internal.HttpServiceController.register(HttpServiceController.java:64)
> at
> org.apache.felix.http.base.internal.DispatcherServlet.init(DispatcherServlet.java:41)
> at
> org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
> at
> org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at org.mortbay.jetty.Server.doStart(Server.java:224)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.apache.felix.http.jetty.internal.JettyService.initializeJetty(JettyService.java:145)
> at
> org.apache.felix.http.jetty.internal.JettyService.startJetty(JettyService.java:112)
> at
> org.apache.felix.http.jetty.internal.JettyService.run(JettyService.java:203)
> at java.lang.Thread.run(Thread.java:619)
> [WARNING] failed org.mortbay.jetty.nio.SelectChannelConnector$1@135f44e:
> java.io.IOException: Unable to establish loopba
> ck connection
> [WARNING] failed [email protected]:8080: java.io.IOException:
> Unable to establish loopback connection
> [WARNING] failed Server@13a34af: java.io.IOException: Unable to establish
> loopback connection
> [ERROR] Exception while initializing Jetty.
> java.io.IOException: Unable to establish loopback connection
> at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
> at
> sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
> at java.nio.channels.Pipe.open(Pipe.java:133)
> at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:104)
> at
> sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
> at java.nio.channels.Selector.open(Selector.java:209)
> at
> org.mortbay.io.nio.SelectorManager$SelectSet.<init>(SelectorManager.java:302)
> at
> org.mortbay.io.nio.SelectorManager.doStart(SelectorManager.java:224)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:314)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at org.mortbay.jetty.Server.doStart(Server.java:235)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.apache.felix.http.jetty.internal.JettyService.initializeJetty(JettyService.java:145)
> at
> org.apache.felix.http.jetty.internal.JettyService.startJetty(JettyService.java:112)
> at
> org.apache.felix.http.jetty.internal.JettyService.run(JettyService.java:203)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.nio.channels.ClosedByInterruptException
> at
> java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:518)
> at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
> at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
> ... 18 more
> [INFO] Started jetty 6.1.x at port 8080
> If you update the test bundle, the URL connection returns a 404 instead (yes,
> the servlet is first unregistered, then re-registered).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira