Runtime update of server side osgi bundles
Hello,
I've written a small RTC server side service extending the TeamRawService (via the com.ibm.team.repository.common.components and com.ibm.team.repository.service.serviceProvider extension points). Version is 3.0.1, works fine so far.
Now I came up with this idea to replace the osgi bundle for this service at runtime with a newer version (via the osgi console). First I wanted to speed up development (no need to restart server), second I want to avoid server reboots in production (better uptime).
I know osgi can handle this in general and I was able install a new version with using the "update" command on the osgi-console. From a osgi point of view I was successful, the new bundle version was installed and in state active. Sadly RTC said to me my component and service are "invalid" after the bundle update. Following errors are shown on the "Component status" page:
CRJAZ1087I Failed to register services for service implementation "testservice.MyRestService".
com.ibm.team.repository.common.transport.TeamServiceRegistryException: CRJAZ1087I Failed to register services for service implementation "testservice.MyRestService".
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.performActivation(AbstractActivationManagerOwner.java:618)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.doActivate(AbstractActivationManagerOwner.java:665)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderActivationManagerOwner.getService(ServiceProviderActivationManagerOwner.java:133)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:248)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:257)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:252)
at com.ibm.team.repository.service.internal.ServerStatusRestService.fetchServiceStatus(ServerStatusRestService.java:282)
at com.ibm.team.repository.service.internal.ServerStatusRestService.getComponentsAndStatus(ServerStatusRestService.java:469)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy82.getComponentsAndStatus(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.doModelledRestService(AbstractTeamServerServlet.java:504)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest2(AbstractTeamServerServlet.java:1867)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest(AbstractTeamServerServlet.java:1723)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.service(AbstractTeamServerServlet.java:1632)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:120)
at com.ibm.team.repository.server.servletbridge.JazzServlet.service(JazzServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.IllegalArgumentException: interface testservice.IMyRestService is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:375)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:594)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.createProxyService(ExportProxyServiceRecord.java:204)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.createExportServiceRecord(ExportProxyServiceRecord.java:171)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.(ExportProxyServiceRecord.java:124)
at org.eclipse.soda.sat.core.util.FactoryUtility.createExportProxyServiceRecord(FactoryUtility.java:186)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:428)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:421)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:444)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportServiceRecords(AbstractActivationManagerOwner.java:472)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.calculateServiceRegistrations(AbstractActivationManagerOwner.java:1097)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.performActivation(AbstractActivationManagerOwner.java:613)
... 48 more
And one additional entry from the ccm.log:
2011-11-17 07:12:06,073 ERROR eam.repository.common.util.ExtensionRegistryReader - CRJAZ0201I The extension reader with plugin id "ServiceProviderRegistry@52605260, pluginId="com.ibm.team.repository.service", extensionPointId="serviceProvider", started=<true>" failed to add an extension to the extension point "com.ibm.team.repository.service.serviceProvider" with the plugin id "com.ibm.team.repository.service.serviceProvider".
java.lang.IllegalStateException: Service implementation conflict. Bundle "testservice" is attempting to provide service class "testservice.MyRestService" but this is already provided by bundle "testservice".
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.addToServiceProviderElementDescriptorMap(ServiceProviderRegistry.java:84)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.handleExtensionAdded(ServiceProviderRegistry.java:341)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.handleExtensionAdded(ServiceProviderRegistry.java:1)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.basicHandleExtensionAdded(ExtensionRegistryReader.java:205)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleExtensionAddedToRegistry(ExtensionRegistryReader.java:624)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleRegistryChanged(ExtensionRegistryReader.java:661)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleRegistryChanged(ExtensionRegistryReader.java:684)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.access$1(ExtensionRegistryReader.java:674)
at com.ibm.team.repository.common.util.ExtensionRegistryReader$3.registryChanged(ExtensionRegistryReader.java:285)
at com.ibm.team.repository.service.internal.registry.ClientLocalizingExtensionRegistry$1.registryChanged(ClientLocalizingExtensionRegistry.java:320)
at org.eclipse.core.internal.registry.ExtensionRegistry$2.run(ExtensionRegistry.java:891)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.registry.ExtensionRegistry.processChangeEvent(ExtensionRegistry.java:889)
at org.eclipse.core.internal.registry.ExtensionRegistry$RegistryEventThread.run(ExtensionRegistry.java:977)
Any Ideas? Do I have to add some code into my activators start/stop methods? After a restart of the server the new bundle version works without a problem, but the restart is exactly what I wanted to avoid.
Stefan
I've written a small RTC server side service extending the TeamRawService (via the com.ibm.team.repository.common.components and com.ibm.team.repository.service.serviceProvider extension points). Version is 3.0.1, works fine so far.
Now I came up with this idea to replace the osgi bundle for this service at runtime with a newer version (via the osgi console). First I wanted to speed up development (no need to restart server), second I want to avoid server reboots in production (better uptime).
I know osgi can handle this in general and I was able install a new version with using the "update" command on the osgi-console. From a osgi point of view I was successful, the new bundle version was installed and in state active. Sadly RTC said to me my component and service are "invalid" after the bundle update. Following errors are shown on the "Component status" page:
CRJAZ1087I Failed to register services for service implementation "testservice.MyRestService".
com.ibm.team.repository.common.transport.TeamServiceRegistryException: CRJAZ1087I Failed to register services for service implementation "testservice.MyRestService".
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.performActivation(AbstractActivationManagerOwner.java:618)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.doActivate(AbstractActivationManagerOwner.java:665)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderActivationManagerOwner.getService(ServiceProviderActivationManagerOwner.java:133)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:248)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:257)
at com.ibm.team.repository.common.transport.internal.registry.OsgiServicesManager.getService(OsgiServicesManager.java:252)
at com.ibm.team.repository.service.internal.ServerStatusRestService.fetchServiceStatus(ServerStatusRestService.java:282)
at com.ibm.team.repository.service.internal.ServerStatusRestService.getComponentsAndStatus(ServerStatusRestService.java:469)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.invoke(ExportProxyServiceRecord.java:370)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.access$0(ExportProxyServiceRecord.java:356)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord$ExportedServiceInvocationHandler.invoke(ExportProxyServiceRecord.java:56)
at $Proxy82.getComponentsAndStatus(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.doModelledRestService(AbstractTeamServerServlet.java:504)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest2(AbstractTeamServerServlet.java:1867)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.handleRequest(AbstractTeamServerServlet.java:1723)
at com.ibm.team.repository.servlet.AbstractTeamServerServlet.service(AbstractTeamServerServlet.java:1632)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.eclipse.equinox.servletbridge.BridgeServlet.service(BridgeServlet.java:120)
at com.ibm.team.repository.server.servletbridge.JazzServlet.service(JazzServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.IllegalArgumentException: interface testservice.IMyRestService is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:375)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:594)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.createProxyService(ExportProxyServiceRecord.java:204)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.createExportServiceRecord(ExportProxyServiceRecord.java:171)
at org.eclipse.soda.sat.core.internal.record.ExportProxyServiceRecord.(ExportProxyServiceRecord.java:124)
at org.eclipse.soda.sat.core.util.FactoryUtility.createExportProxyServiceRecord(FactoryUtility.java:186)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:428)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:421)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportProxyServiceRecord(AbstractActivationManagerOwner.java:444)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.createExportServiceRecords(AbstractActivationManagerOwner.java:472)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.calculateServiceRegistrations(AbstractActivationManagerOwner.java:1097)
at com.ibm.team.repository.common.transport.internal.registry.AbstractActivationManagerOwner.performActivation(AbstractActivationManagerOwner.java:613)
... 48 more
And one additional entry from the ccm.log:
2011-11-17 07:12:06,073 ERROR eam.repository.common.util.ExtensionRegistryReader - CRJAZ0201I The extension reader with plugin id "ServiceProviderRegistry@52605260, pluginId="com.ibm.team.repository.service", extensionPointId="serviceProvider", started=<true>" failed to add an extension to the extension point "com.ibm.team.repository.service.serviceProvider" with the plugin id "com.ibm.team.repository.service.serviceProvider".
java.lang.IllegalStateException: Service implementation conflict. Bundle "testservice" is attempting to provide service class "testservice.MyRestService" but this is already provided by bundle "testservice".
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.addToServiceProviderElementDescriptorMap(ServiceProviderRegistry.java:84)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.handleExtensionAdded(ServiceProviderRegistry.java:341)
at com.ibm.team.repository.common.transport.internal.registry.ServiceProviderRegistry.handleExtensionAdded(ServiceProviderRegistry.java:1)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.basicHandleExtensionAdded(ExtensionRegistryReader.java:205)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleExtensionAddedToRegistry(ExtensionRegistryReader.java:624)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleRegistryChanged(ExtensionRegistryReader.java:661)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.handleRegistryChanged(ExtensionRegistryReader.java:684)
at com.ibm.team.repository.common.util.ExtensionRegistryReader.access$1(ExtensionRegistryReader.java:674)
at com.ibm.team.repository.common.util.ExtensionRegistryReader$3.registryChanged(ExtensionRegistryReader.java:285)
at com.ibm.team.repository.service.internal.registry.ClientLocalizingExtensionRegistry$1.registryChanged(ClientLocalizingExtensionRegistry.java:320)
at org.eclipse.core.internal.registry.ExtensionRegistry$2.run(ExtensionRegistry.java:891)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.registry.ExtensionRegistry.processChangeEvent(ExtensionRegistry.java:889)
at org.eclipse.core.internal.registry.ExtensionRegistry$RegistryEventThread.run(ExtensionRegistry.java:977)
Any Ideas? Do I have to add some code into my activators start/stop methods? After a restart of the server the new bundle version works without a problem, but the restart is exactly what I wanted to avoid.
Stefan