Details
Description
I have a bundle that exports a service via DOSGi. Once the bundle is started, I can point a browser to the exported URL and see the service is up and running. However, if the bundle is now stopped, the service at the URL is still there! Finally, if the bundle is now started again, it fails with an error about the endpoint already existing (stack trace below).
The issue appears to be that the server is never stopped even when the service is unregistered, since the server reference isn't passed to the ExportRegistrationImpl that is later closed.
A proposed patch is attached which fixes this (plus, for good measure, it cleans up the code by replacing a locally used Map with a List since only the map values are ever used.)
java.lang.RuntimeException: Soap 1.1 endpoint already registered on address http://192.168.1.1:9000/my/test/TestService
at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:921)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131)[164:org.apache.cxf.cxf-api:2.7.2]
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:204)[172:org.apache.cxf.cxf-rt-frontend-simple:2.7.2]
at org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFromFactory(AbstractPojoConfigurationTypeHandler.java:208)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:118)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:119)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:64)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:58)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_17]
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:58)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:37)[56:cxf-dosgi-ri-dsw-cxf:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(TopologyManagerExport.java:249)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.access$300(TopologyManagerExport.java:50)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
at org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$3.run(TopologyManagerExport.java:214)[72:cxf-dosgi-ri-topology-manager:1.5.0.SNAPSHOT]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_17]
at java.lang.Thread.run(Thread.java:722)[:1.7.0_17]