-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soteria on Tomcat sometimes fails to register itself during server startup #315
Comments
The problem is inside
which in turns use
which uses JNDI to get the CDI BeanManager instead of
which is standard from CDI v1.1 and to get the instance of CdiExtension I've used:
in this way soteria never fails to startup |
Indeed, and originally I tried to use that exclusively. But then a lot of reports came in about issues with that, often getting the wrong bean archive. See also: https://lists.jboss.org/pipermail/cdi-dev/2016-May/008297.html Did you see what exactly happened? Was the BeanManager null, or did the BeanManager obtained from JNDI fail to find the CdiExtension class? |
Ok, https://stackoverflow.com/questions/19729370/servletcontextlistener-execution-order so if I define a web-fragment.xml like the one inside OmniFaces everything works
|
Interesting indeed. Yes, for an issue quite like this I've started a discussion about that before. See https://eclipse.org/lists/servlet-dev/msg00170.html If you want, maybe it's a good idea to restart that discussion by posting about this case to the servlet list? |
After many experiments the cleanest solution is to transform
in this way we don't need the web-fragment.xml file hack or beans.xml or @ApplicationScoped on SamRegistrationInstaller ... |
It's a bit of a chicken and egg issue there, since a CDI extension does not have the servlet context available. That context is needed to register the AuthConfigFactory
.getFactory()
.registerServerAuthModule(new HttpBridgeServerAuthModule(cdiPerRequestInitializer), ctx); |
Actually CDI spec v3.0 says that, If you take a look at my implementation, the signature of the method is exactly:
Even more on CDI v4.0 finally they made the @startup event which is a shortcut for @initialized(ApplicationScoped.class) I'm using my fork in production right now for a side project and is working fine The only problem with tomcat redeploy / parallel deploy it's on the exousia side |
Interesting idea indeed. I guess the extension interface is not needed here, as |
Hi Any updates on that issue? It seems that Soteria has migrated to Jakarta EE 10. |
JSF 3.0.2 + Weld 4.0.2 + Soteria 2.0.1 on Tomcat 10.0.14 on latest OpenJDK 17
Soteria print the following line on the Log during Tomcat startup:
[org.glassfish.soteria.servlet.SamRegistrationInstaller onStartup] Initializing Soteria 2.0.1 for context ...
BUT Sometimes it fails to register itself, in fact the Log line is missing
When it happens the Login mechanism do not work and you will get:
if your try to manually login from the login page you get the same output of securityContext.authenticate always returns SUCCESS when I used a custom form in JSF 2.3 #194
If you try to navigate directly to a page which requires a role to diplay you will get a 403 instead of a redirect to the login page!
In this case I have to stop the server + remove the deploy + delete work/Catalina directory + restart
The text was updated successfully, but these errors were encountered: