Repository navigation
Keycloak entity manager is not created with Quarkus #13302
Unanswered
arseni-radziuk
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I am using Keycloak 18.0.2 and I have the following configuration in conf/quarkus.properites:
quarkus.datasource.user.db-kind=postgresql
quarkus.datasource.user.username=username
quarkus.datasource.user.password= password
quarkus.datasource.user.jdbc.url=<VALID_URL>
quarkus.hibernate-orm.user.database.generation=none
quarkus.hibernate-orm.user.datasource=user
quarkus.hibernate-orm.user.packages=<VALID_PACKAGE_WITH_ENTITY_CLASS>
In the class implementing UserStorageProvider I am unable to get EntityManager injected with the following code (it is resolved as null value):
@Inject
@PersistenceUnit("user")
EntityManager entityManager;
At the same time, the data source is injected properly with the following code:
@Inject
@Datasource("user")
AgroalDataSource agroalDataSource;
I tried adding the default data source to quarkus.properties, using persistence.xml instead of quarkus.properites and some other different configuration options.
When persistence.xml was used, the persistent unit added to the file was read and some initialization started to be executed but Keycloak server startup failed with ERROR: java.lang.NullPointerException.
I noticed that the entity class is attached to keycloak-detault persistent unit instead of the persistent unit configured in quarkus.properties.
Does anyone have an idea what kind of extra configuration might be required to get EntityManager created?
All reactions