-
Notifications
You must be signed in to change notification settings - Fork 148
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
Custom jacc provider fails to find BeanManager via JNDI (java:comp/BeanManager) #24677
Comments
Can you quickly try it yet with 7.0.9? We did some changes related to authentication, it might be a bug. |
Thanks for the report! It's a long time ago I created that example, and I would have to take a look at it again. One important question though; on Payara did you also install the JACC Provider in the \glassfish\domains\my-domain\lib folder, or did you install it using the JACC-per-app feature I added to Payara? Note btw that for Jakarta EE 11 / GlassFish 8, the JACC Provider will have to change as the JDK Policy is deprecated for removal. The plan is also to make that example a default feature in Jakarta Security. See: |
I tested on Glassfish 7.0.9 with the same "NameNotFoundException: No object bound for java:comp/BeanManager" result. I have the same domain configuration in use for both Payara and Glassfish the same domain.xml configuration like:
and the jars are in the domain specific lib on the same location:
I tested again using Payara with my logging enabled.
Payara: CustomPolicy constructor called after ear deployment
Glassfish: CustomPolicy constructor called before ear deployment
Trace from my code contains eventually: "NameNotFoundException: No object bound for java:comp/BeanManager" on both 7.0.9 and 7.0.10
|
I was not aware a JACC per application option exists in Payara, I assume you mean: I think (not 100% sure) the dependencies used to build the custom provider are:
I am sure there are no Payara specific dependencies. |
I can also add that instead of manually looking for: I can try to build a reproducer if needed. |
Hi @escay, it looks like the EJB container is initialized before the CDI container, and then CDI is not available in your custom JACC provider. Can you try adding |
All ejb modules and war modules (and there are many) have beans.xml, most of them use bean-discovery-mode="none" to make deployment quicker / avoid scanning (since they only contain EJB annotations), only web uses some "annotated" for CDI annotations. The custom JACC provider is already loaded and active before any ear file is deployed when I configure it in Glassfish. Another note: The workaround for me is:
This seems to work reliably in the last few days. There is no need to improve things in Glassfish at this moment, I can wait to see what the new JakartaEE11 / GF8 solution brings. |
Environment Details
Problem Description
I have a custom jacc provider.
The jar is placed it in the /lib folder, and registered in domain.xml.
The implementation is based on Arjan Thijms example from:
https://arjan-tijms.omnifaces.org/2015/03/java-ee-authorization-jacc-revisited.html
This provider works on Payara 5.2022 and 6.2023, but now I try to use the same provider on GlassFish 7.
The jacc provider is registered during startup. No errors.
What is special about the implementation is that it wants to use BeanManager via JNDI.
The jacc provider jar contains interface class:
The implementation bean:
is part of the ear file (as an ejb jar with beans.xml) of the application that needs to use the jacc provider and will make some database calls and reuses the datasource that is already configured for the ear file. The goal is to find the application scoped CustomAuthorizationMechanism instance by trying to load the AuthorizationMechanism via BeanManager.
When I deploy an ear file at one point deployment of the ear fails with NameNotFoundException: No object bound for java:comp/BeanManager:
the relevant code shortened is:
Impact of Issue
The questions I have are:
The text was updated successfully, but these errors were encountered: