I have a vaadin app, that is a simple multiplayer game. I update the game when a database change is made in my firestore database. The problem im getting is that when try to add this listener to the current session i get an error saying java.util.concurrent.ExecutionException: org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name ‘scopedTarget.gameService’: Scope ‘session’ is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
at com.vaadin.flow.server.FutureAccess.get(FutureAccess.java:62) ~[flow-server-24.3.10.jar:24.3.10]
at com.vaadin.flow.server.VaadinService.runPendingAccessTasks(VaadinService.java:2085) ~[flow-server-24.3.10.jar:24.3.10]
Are you trying to use a session scoped bean from a thread?
Yes im trying access a sessionScoped view with a service which fetches data from the rest api on database change.
The Vaadin SessionScope is only available if it is access via UI.
You have to change the scope of the bean
How would this look like. I’m still a bit confused. I still want there to be a unique session every single time a different user connects. currently my gameService has the following Scope @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) and my gameView has @VaadinSessionScope
It looks like you are mixing Vaadin session and HTTP Session.
So your gamingService must also be VaadinSessionScope