Bug 360481 - [OSGi Integration] OSGi Http Service configured twice when registering two service instances of org.eclipse.rwt.application.ApplicationConfigurator
Summary: [OSGi Integration] OSGi Http Service configured twice when registering two se...
Status: NEW
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 372114 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-10 15:48 EDT by Ralf Zahn CLA
Modified: 2012-07-16 09:42 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Zahn CLA 2011-10-10 15:48:07 EDT
Build Identifier: 1.5.0-N-20111009-0111

I have an application that provides two org.eclipse.rwt.application.ApplicationConfigurator service instances. For each instance, the OSGi Http Service is configured, which occurs an error:

[10.10.11 21:41:55:981 CEST] 0000004c SystemErr     R Unable to start RWT application.
[10.10.11 21:41:55:981 CEST] 0000004c SystemErr     R java.lang.RuntimeException: org.osgi.service.http.NamespaceException: The alias '/rwt-resources' is already in use.
[10.10.11 21:41:55:981 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.registerResourceDirectory(ApplicationReferenceImpl.java:191)
[10.10.11 21:41:55:981 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.startRWTApplication(ApplicationReferenceImpl.java:76)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.start(ApplicationReferenceImpl.java:60)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl.doLaunch(ApplicationLauncherImpl.java:101)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl.launch(ApplicationLauncherImpl.java:83)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl.launch(ApplicationLauncherImpl.java:159)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl.launchAtHttpService(ApplicationLauncherImpl.java:137)
[10.10.11 21:41:55:982 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl.addHttpService(ApplicationLauncherImpl.java:46)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.HttpTracker.addingService(HttpTracker.java:30)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.HttpTracker.addingService(HttpTracker.java:1)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
[10.10.11 21:41:55:983 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
[10.10.11 21:41:55:984 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
[10.10.11 21:41:55:984 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
[10.10.11 21:41:55:984 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
[10.10.11 21:41:55:984 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
[10.10.11 21:41:55:984 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
[10.10.11 21:41:55:991 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
[10.10.11 21:41:55:991 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
[10.10.11 21:41:55:991 CEST] 0000004c SystemErr     R 	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:507)
[10.10.11 21:41:55:991 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
[10.10.11 21:41:55:991 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:329)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.init(ServletWrapperImpl.java:168)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1283)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:973)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3639)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:950)
[10.10.11 21:41:55:992 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[10.10.11 21:41:55:993 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R 	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
[10.10.11 21:41:55:994 CEST] 0000004c SystemErr     R Caused by: org.osgi.service.http.NamespaceException: The alias '/rwt-resources' is already in use.
[10.10.11 21:41:55:995 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.registerServlet(ProxyServlet.java:164)
[10.10.11 21:41:55:995 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.ProxyServlet.registerResources(ProxyServlet.java:194)
[10.10.11 21:41:55:995 CEST] 0000004c SystemErr     R 	at org.eclipse.equinox.http.servlet.internal.HttpServiceImpl.registerResources(HttpServiceImpl.java:78)
[10.10.11 21:41:55:995 CEST] 0000004c SystemErr     R 	at org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl.registerResourceDirectory(ApplicationReferenceImpl.java:187)
[10.10.11 21:41:55:995 CEST] 0000004c SystemErr     R 	... 48 more

Reproducible: Always

Steps to Reproduce:
1. Create more than one service instance of org.eclipse.rwt.application.ApplicationConfigurator
2. Start the RWT platform
Comment 1 Frank Appel CLA 2011-10-11 03:28:07 EDT
If you want to register two ApplicationConfigurators at the same HttpService you have to set either a different contextName for both configurations in ApplicationLauncher#launch(...) or use an appropriate service property. Unfortunately the latter is not implemented yet :-( I will do this ASAP.
This way the applications can work properly isolated.

Starting two ApplicationConfigurators with the context value null leads to several problems. One of these is that the system wants to use the same mapping for static resources twice. This is what the exception is about. I admit that the resulting error message could be improved...

Another problem is that two application configurations could register the same servlet name twice. Having no contextName the system would not know which one to choose. But actually you would run in the same exception like the one below before...

Think of an application like a webcontext of an webcontainer. Each application can have multiple servlets, brandings etc. but you can not mix them up.
Comment 2 Ralf Zahn CLA 2011-10-11 05:14:54 EDT
So the result is: If I have my RWT/RAP application with different EntryPoints, I have to register them with only a single ApplicationConfigurator?
Okay, in such case, there should an error occur (maybe earlier) that tells me that I have two ApplicationConfigurators with the same contextName.
Comment 3 Ivan Furnadjiev CLA 2012-07-16 09:42:24 EDT
*** Bug 372114 has been marked as a duplicate of this bug. ***