Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 386504 - Can not deploy multiple applications in parallel on Equinox
Summary: Can not deploy multiple applications in parallel on Equinox
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: PC Mac OS X
: P3 major (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 393754 (view as bug list)
Depends on: 390381
Blocks:
  Show dependency tree
 
Reported: 2012-08-02 10:55 EDT by Holger Staudacher CLA
Modified: 2018-05-01 07:49 EDT (History)
3 users (show)

See Also:


Attachments
Test project (20.65 KB, application/octet-stream)
2012-08-06 10:09 EDT, Ivan Furnadjiev CLA
no flags Details
Proposed fix (4.09 KB, patch)
2012-09-12 11:35 EDT, Ralf Sternberg CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Staudacher CLA 2012-08-02 10:55:58 EDT
We have the following setup. One Workbench Application and 2 OSGi service based RAP applications within one OSGi container. The two services are registered with the service property contextName. When launching all together only one out of the three applications can be started. When accessing another the following error occurs.

java.lang.IllegalArgumentException: Entry point not found: default
 at org.eclipse.rwt.internal.lifecycle.EntryPointUtil.getEntryPointByName(EntryPointUtil.java:94) ~[na:na]
 at org.eclipse.rwt.internal.lifecycle.EntryPointUtil.findCurrentEntryPointRegistration(EntryPointUtil.java:52) ~[na:na]
 at org.eclipse.rwt.internal.lifecycle.EntryPointUtil.getCurrentEntryPointProperties(EntryPointUtil.java:40) ~[na:na]
 at org.eclipse.rwt.internal.service.StartupPageConfigurer.applyEntryPointProperties(StartupPageConfigurer.java:190) ~[na:na]
 at org.eclipse.rwt.internal.service.StartupPageConfigurer.getTemplate(StartupPageConfigurer.java:77) ~[na:na]
 at org.eclipse.rwt.internal.service.StartupPage.send(StartupPage.java:44) ~[na:na]
 at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.handleGetRequest(LifeCycleServiceHandler.java:77) ~[na:na]
 at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.synchronizedService(LifeCycleServiceHandler.java:64) ~[na:na]
 at org.eclipse.rwt.internal.service.LifeCycleServiceHandler.service(LifeCycleServiceHandler.java:58) ~[na:na]
 at org.eclipse.rwt.engine.RWTServlet.handleValidRequest(RWTServlet.java:101) ~[na:na]
 at org.eclipse.rwt.engine.RWTServlet.doPost(RWTServlet.java:80) ~[na:na]
 at org.eclipse.rwt.engine.RWTServlet.doGet(RWTServlet.java:72) ~[na:na]
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[javax.servlet_2.5.0.v201103041518.jar:na]
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) ~[javax.servlet_2.5.0.v201103041518.jar:na]
 at org.eclipse.rap.rwt.osgi.internal.CutOffContextPathWrapper.service(CutOffContextPathWrapper.java:106) ~[na:na]
 at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61) ~[na:na]
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128) ~[na:na]
 at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60) ~[na:na]
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) ~[javax.servlet_2.5.0.v201103041518.jar:na]
 at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317) ~[org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar:na]
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.Server.handle(Server.java:326) ~[org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) [org.mortbay.jetty.server_6.1.23.v201012071420.jar:na]
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) [org.mortbay.jetty.util_6.1.23.v201012071420.jar:na]
Comment 1 Ivan Furnadjiev CLA 2012-08-02 11:18:13 EDT
Holger, this sounds to me as a duplicate of bug 377414. Can you confirm?
Comment 2 Holger Staudacher CLA 2012-08-02 11:24:00 EDT
Hi Ivan,
no it's not a duplicate. It's worse ;)
The workaround Ralf describes does not work. I have registered the 2 services with different context names.
Comment 3 Ivan Furnadjiev CLA 2012-08-06 08:03:37 EDT
A simple project to reproduce the issue will be welcomed.
Comment 4 Ivan Furnadjiev CLA 2012-08-06 10:09:20 EDT
Created attachment 219593 [details]
Test project

Simple project with one Workbench application and two services.
Comment 5 Ivan Furnadjiev CLA 2012-08-07 06:08:31 EDT
The problem is the following. The application context is buffered in the session store (see ServiceContext#getApplicationContext()). With the attached test project we have three application contexts. When you load the first entry point... its application context is buffered in the session store. Typing a new URL (of the second entry point) does not change the HTTP session and we end up in the same session store with already buffered previous application context. This leads to wrong application context, wrong entry point manager and missing entry point registration. As a workaround, do not use cookie to identify a session [1]
[1] http://wiki.eclipse.org/RAP/FAQ#How_to_run_a_RAP_application_in_multiple_browser_tabs.2Fwindows.3F
Comment 6 Ralf Sternberg CLA 2012-09-12 11:35:02 EDT
Created attachment 220976 [details]
Proposed fix

The ApplicationContext is buffered in the SessionStore for performance reasons.

In a case called a "session restart" in LifeCycleServiceHandler, we restore the old application context in LCSH#reinitializeSessionStore(). This is usually the case when the browser is refreshed, e.g pressing F5. But also in case the user navigates to a different URL, we run into this "session restart" code, even though the new URL may belong to a different application.

I don't recall why we restore the application context at all, but this is causing the actual problem. It seems to be an optimization which is a bit too aggressive. Not restoring the ApplicationContext shouldn't be an issue as it can always be obtained from the servlet context.
Comment 7 Ralf Sternberg CLA 2012-09-25 15:13:22 EDT
I was wrong with my statement in comment 6. When applications are properly isolated, the ApplicationContext can never change within a Session. Unfortunately, applications are currently not isolated in Equinox. Therefore, requests for one application end up in another which causes this bug.

The details: Our current approach of isolating applications is to store the ApplicationContext in the ServletContext. We assume that different applications have different ServletContexts. To achieve this, we register servlets and resources of different applications with different HttpContexts.

In Felix, different HttpContexts lead to different ServletContexts, but in Equinox, all servlets share the same ServletContext. Therefore, our applications are not isolated in Equinox. I've opened bug 390381 to request a similar behavior in Equinox as in Felix.
Comment 8 Markus Knauer CLA 2013-05-24 09:21:11 EDT
Setting the severity to "major". I'd say it's not a "blocking" bug that prevents the release of RAP but I admit that it's very annoying in some scenarios.

We've been in contact with people from Equinox and from the OSGi http spec and we think that we can solve this in the long run (but not in the Kepler time frame).
Comment 9 Ralf Sternberg CLA 2013-06-07 08:57:02 EDT
*** Bug 393754 has been marked as a duplicate of this bug. ***
Comment 10 Ivan Furnadjiev CLA 2018-05-01 07:49:46 EDT
The underlying OSGi issue is fixed. Tested and verified that the issue is fixed.