Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Assertion error: No userId available
Assertion error: No userId available [message #1751002] Tue, 03 January 2017 15:21 Go to next message
Kevin Kirn is currently offline Kevin KirnFriend
Messages: 19
Registered: September 2014
Junior Member
Hello everyone!

We've been using eclipse scout for a while now, and are quite happy with it.

While testing our application, we discovered following behaviour:
1) We authenticate (login) with User A.
2) Application loads, everything works.
3) Seconds later, we authenticate (in other browser, or even on other computer) with another User B.
4) Application start fails with "Initialization failed"

This behaviour does only occour when application runs on a Tomcat (Windows Server). Within eclipse this never happends!

The error logged says "No userId available". See full stack trace:
org.eclipse.scout.rt.platform.util.Assertions$AssertionException: Assertion error: No userId available [user=admin, calling-thread=https-jsse-nio-8443-exec-4, job=Starting ClientSession [sessionId=758019ed-6fc6-4f16-8c25-0c7c13f11c04]]
	at org.eclipse.scout.rt.platform.util.Assertions.fail(Assertions.java:580)
	at org.eclipse.scout.rt.platform.util.Assertions.assertNotNull(Assertions.java:87)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.checkSession(ClientSessionRegistry.java:105)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.sessionStarted(ClientSessionRegistry.java:98)
	at org.eclipse.scout.rt.client.clientnotification.ClientSessionRegistry.sessionChanged(ClientSessionRegistry.java:223)
	at org.eclipse.scout.rt.client.AbstractClientSession.fireSessionChangedEvent(AbstractClientSession.java:646)
	at org.eclipse.scout.rt.client.AbstractClientSession.start(AbstractClientSession.java:328)
	at org.eclipse.scout.rt.client.session.ClientSessionProvider$1$1.call(ClientSessionProvider.java:81)
	at org.eclipse.scout.rt.client.session.ClientSessionProvider$1$1.call(ClientSessionProvider.java:1)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.context.RunContextRunner$1.call(RunContextRunner.java:42)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:185)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor$1.run(SubjectProcessor.java:47)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Unknown Source)
	at org.eclipse.scout.rt.platform.security.SubjectProcessor.intercept(SubjectProcessor.java:43)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:121)
	at org.eclipse.scout.rt.platform.context.RunContextRunner.intercept(RunContextRunner.java:38)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:180)
	at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:135)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask$1.call(JobFutureTask.java:100)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at org.eclipse.scout.rt.platform.job.internal.JobFutureTask.run(JobFutureTask.java:160)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
	at org.eclipse.scout.rt.platform.job.internal.NamedThreadFactory$1.run(NamedThreadFactory.java:54)


Somebody posted the same issue, I tried to get rid of it using thier inputs - unfortunately without success.
https://www.eclipse.org/forums/index.php/t/1081251/

We've done a lot of work managing users, since we have a special setup where every user should have it's own database. So I thought, maybe we broke something or our code is causing this issue.
To check this, I created a complete new scout project in an empty workspace and deployed it without modifications on the tomcat server.

I logged in with scott/tiger, opened another browser and tired to login as admin/admin. Exactly the same issue occured, which indicates that there must be another problem besides the code.

What we are using:
Windows Server 2012
Apache Tomcat/9.0.0.M9
Java 8
org.eclipse.scout.rt.version: 6.0.200.0

Access to server can be granted if needed.

Do you have an idea what is causing this issue? Might Tomcat 9 be incompatible?

Best regards

Kevin

UPDATE:
Using Tomcat 8 this issue does not occour, so it might really be incompatible with version9.

[Updated on: Tue, 03 January 2017 18:08]

Report message to a moderator

Re: Assertion error: No userId available [message #1751532 is a reply to message #1751002] Wed, 11 January 2017 09:08 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Kevin,

I made a quick test on Tomcat 9 and did not encounter any issues so far. Did you make sure that your application is the only Scout application deployed on that specific Tomcat instance? Maybe you need to clear the "work" and "temp" directories as well.

Regards,
Beat
Re: Assertion error: No userId available [message #1752699 is a reply to message #1751532] Thu, 26 January 2017 09:48 Go to previous messageGo to next message
Kevin Kirn is currently offline Kevin KirnFriend
Messages: 19
Registered: September 2014
Junior Member
Hi Beat

Meanwhile I've setup the productive enviroment, which now is using Ubuntu 16.04 (should not be important here).

During this setup, I encountered again the same issue. As I thought that it's something related to Tomcat 9.x I installed Tomcat 8.5.11 to prevent this issue.

When the enviroment was set up and I made the very first deployment, I was able to observe the exact same behaviour as described above (second login ends in "Initialization failed").

A bit frustrated I reinstalled tomcat, now version 8.0.41 - were this issue never appears. Thus, I assume something from 8.0 to 8.5 is causing this behaviour. (see update: it appears after a while also on 8.0.41, so nothing to do with that)

To answer your questions and give some informations:
1) It's the only scout application deployed (client and server)
2) Clearing tmp and work dir did not solve this issue
3) We are using database auth
4) Tomcat config is basically standard - nothing special
5) I did not test the contacts app on the productive enviroment as I did before
6) It can be reproduced, it's not something happening sporadically

For now, using 8.0 solves this - but it doesn't feel good being not able to update. If you still are unable to reproduce, I can provide you a instance to do so (if you're intrested in).

UPDATE:
Was a bit to fast, it's not solved - I've now read that server and client should be hosted on different machines (in production), however it is not supposed to crash on one right? One scout application is in my understanding server and client.

Best regards

Kevin

[Updated on: Thu, 26 January 2017 14:26]

Report message to a moderator

Re: Assertion error: No userId available [message #1752777 is a reply to message #1752699] Fri, 27 January 2017 08:27 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Kevin,

I'm very sorry that you are experiencing so much trouble. I know that those problems can be quite frustrating.

Because the issue you describe sounded quite serious, I had another look at it. Unfortunately, I could not reproduce it with the following setup:


  • Versions:

    • Eclipse Scout SDK: Neon.2 Release (4.6.2); Build id: 20161208-0600
    • Scout version: 6.0.200.0
    • Java: Java(TM) SE Runtime Environment (build 1.8.0_31-b13); Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

  • I created a "Scout Hello World" application using the "New Project" wizard. The only thing I changed was the server connection in the config.properties (http instead of https, port 8080) and I removed the <secure> flag from web.xml, as describe here: http://eclipsescout.github.io/6.0/beginners-guide.html#update-the-scout-application-to-work-with-http
  • I downloaded the standalone ZIPs for Apache Tomcat, versions apache-tomcat-8.5.11-windows-x64 and apache-tomcat-9.0.0.M15-windows-x64, respectively. (I did not notice any differences between the two.)
  • Then I built the helloworld app using Maven and dropped the two war files into the webapps folder.
  • Login in Chrome with scott:tiger -> ok. Then login in Firefox (definitively a different browser) with admin:admin -> ok. Both instances were working as expected.


I did my test on Windows, but this should not have any influence. Is it possible that the database authentication module you use has something to do with it?

Running server and client/UI on the same appserver is perfectly fine. Only running two UI apps on the same server will cause problems. Different servers can help distributing the load in a clustered environment (e.g. 1 server node and multiple UI nodes).

I have attached the two *.war files I used for my test. Maybe you can try them out in your environment and check for any differences.

Regards,
Beat
Re: Assertion error: No userId available [message #1752796 is a reply to message #1751002] Fri, 27 January 2017 12:02 Go to previous messageGo to next message
Kevin Kirn is currently offline Kevin KirnFriend
Messages: 19
Registered: September 2014
Junior Member
Hello Beat

First of all, we're very thankful for your effort to help.

Important clarification
When I created this thread, I posted the StackTrace containing a message like "Assertion error: No userId available". As mentioned above, we then changed to tomcat 8.0.39/8.0.41 - which we thought solved the issue. As we've learned from the referenced thread, were the same exception was mentioned, they solved it by making sure not to deploy two client .wars to the same tomcat instance. It is possible, that at the time I created this thread, we maybe had two clients deployed (by mistake or maybe we didn't cleared the work or temp folders). This would explain why it later worked with a fresh installation of tomcat, since there was nothing deployed before.

Today's status
I think, we were now able to locate the issue. During this week, we've build the productive enviroment - where we observed following behaviour:
1) Login of user A works
2) Login of user B in another browser fails with "Initialization failed"
3) As logged in user A, perform logout (/logout)
4) Login of any user works
5) Behaviour continuous at point 2)

So obviously, only one user is able to login simultaneously until the related session is destroyed. In the server.app.log we were also able to observe:
1) When first user performes login, a new server session is created
2) When second user tries to login, execLoadSession (ServerSession.java) is not performed - since LOG.info("created a new session for {}", getUserId()); is not printed and the very first SQL which is performed is the load of the first page.

This behaviour was the same as the initially posted one, but now there was no longer the message "Assertion error: No userId available".

The error, we are no struggling with is caused by the following vHost defined in conf/server.xml. Whith this, we want to achieve that the application is invoked by app.domain.com.
<Host name="app.domain.com" appBase="webapps">
        <Context path="/" docBase="ch.primesystems.kamugo.ui.html" />
</Host>


When we remove this vHost, it works as expected - if we add it, it's causing the above described issue/behaviour. Also, if we keep the vHost but access the whole path to the application it also works - so only if we access the host via the vHost it fails. This should be reproducible. What's maybe important:
- we use a Let's encrypt certificate, so SSL connections are used
- we force a redirect from http connections to https connections

Have you any input on how to properly use / define a vHost?

Best regards

Kevin

[Updated on: Fri, 27 January 2017 12:03]

Report message to a moderator

Re: Assertion error: No userId available [message #1752815 is a reply to message #1752796] Fri, 27 January 2017 15:24 Go to previous message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Kevin,

Ah, that special context configuration is indeed the cause of the error! Adding this definition has the same effect as adding a second UI application, with the same issues ("No userId available"). Why is that? Tomcat apparently always automatically deploys all webapps it finds in the "webapps" subdirectory. The special root context you are defining is additional. So the same webapp is started twice, which causes trouble because the JVM's cookie manager is a singleton.

From the Tomcat documentation (https://tomcat.apache.org/tomcat-8.5-doc/config/context.html):

"path: (...) Even when statically defining a Context in server.xml, this attribute must not be set unless either the docBase is not located under the Host's appBase or both deployOnStartup and autoDeploy are false. If this rule is not followed, double deployment is likely to result."

I see two solutions:

1. Try deploying your UI-WAR outside the "webapps" folder and then using a relative or absolute path in the "docBase" attribute:

<Context path="/" docBase="../special/org.eclipse.scout.apps.helloworld.ui.html" />


(Untested, but should work according to the documentation.)

2. Use Tomcat's default configuration and don't expose the tomcat server to the internet. Instead, use a separate reverse proxy server (Apache httpd and nginx seem to be quite popular) that transparently redirects incomming requests to the tomcat URL. This is probably the better solution for productive systems anyway.

Regards,
Beat
Previous Topic:[mars] RAP + DataSourceSecurityFilter
Next Topic:[neon] AbstractPageWithTable and Custom TableControls
Goto Forum:
  


Current Time: Wed Apr 24 13:35:10 GMT 2024

Powered by FUDForum. Page generated in 0.03218 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top