Hello, I have a Jmix project on two different machines that use two different versions of the Jmix plugin. One uses version 2.4.2 and the other 2.5.2.
The project contains the following in the application properties:
jmix.ui.login-view-id = Home
jmix.ui.main-view-id = Home
jmix.ui.default-view-id = Home
In version 2.5.2, I get an error, while in version 2.4.2 the application works.
org.springframework.beans.factory.support.ScopeNotActiveException: Error creating bean with name ‘core_SessionData’: 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 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:385) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) ~[spring-beans-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getObject(DefaultListableBeanFactory.java:2079) ~[spring-beans-6.1.15.jar:6.1.15]
at com.company.jmixprogettostudio.listener.AuthenticationEventListener.onAuthenticationSuccess(AuthenticationEventListener.java:32) ~[main/:na]
at jdk.internal.reflect.GeneratedMethodAccessor60.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[na:na]
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:365) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:237) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:168) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) ~[spring-context-6.1.15.jar:6.1.15]
at org.springframework.security.authentication.DefaultAuthenticationEventPublisher.publishAuthenticationSuccess(DefaultAuthenticationEventPublisher.java:99) ~[spring-security-core-6.3.4.jar:6.3.4]
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:226) ~[spring-security-core-6.3.4.jar:6.3.4]
at io.jmix.core.security.impl.SystemAuthenticatorImpl.begin(SystemAuthenticatorImpl.java:75) ~[jmix-core-2.4.2.jar:na]
at io.jmix.email.impl.EmailerImpl.processQueuedEmails(EmailerImpl.java:266) ~[jmix-email-2.4.2.jar:na]
at io.jmix.autoconfigure.email.job.EmailSendingJob.execute(EmailSendingJob.java:32) ~[jmix-email-starter-2.4.2.jar:na]
at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.3.2.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) ~[quartz-2.3.2.jar:na]
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131) ~[spring-web-6.1.15.jar:6.1.15]
Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.web.context.request.SessionScope.get(SessionScope.java:55) ~[spring-web-6.1.15.jar:6.1.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:373) ~[spring-beans-6.1.15.jar:6.1.15]
... 23 common frames omitted
The error occurs exactly at this point.
in sessionDataProvider. The function is not called on startup in version 2.4.2, but only when I press the login button (I’m already in home view wich is not the case for 2.5.2 this is called before going in home view).
In version 2.5.2, instead, it gets called immediately, throws an error, and doesn’t show me the program’s home screen.
The goal was to redirect anonymous users to the home screen, and only show the login screen when the login button is pressed.