[keycloak-user] Additional jpaConnectionProvider for UserFederation via database
Harold Campbell
hcamp at muerte.net
Tue Jan 5 19:00:37 EST 2016
On Wed, 2015-11-11 at 14:12 +0100, Stian Thorgersen wrote:
> At the moment when the provider is specified in keycloak-server.json
> we only load that one provider. If you only need to use the
> EntityManagerFactory within your user federation provider you don't
> need a JpaConnectionProvider at all. Just create the
> EntityManagerFactory within your UserFederationProviderFactory.
I'm trying to do exactly that, but can't for the life of me get the
EntityManagerFactory to create. It fails with:
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named XXXXX
Before that, I also see this warning even if I explicitly pass the suggested provider as a property:
17:43:57,250 WARN [org.hibernate.ejb.HibernatePersistence] (default task-53) HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
The persistence.xml is in META-INF. I also tried META-INF/classes/META-
INF.
My init code:
private void lazyInit() {
Map<String, Object> props = new HashMap<>();
props.put(AvailableSettings.PROVIDER, "org.hibernate.jpa.HibernatePersistenceProvider");
props.put(AvailableSettings.TRANSACTION_TYPE, "RESOURCE_LOCAL");
props.put("jboss.as.jpa.managed", "false");
emFactory = Persistence.createEntityManagerFactory("XXXXX", props);
}
This same persistence unit works just fine when bundled on it's own
within a normal JEE EAR.
Any idea what I'm doing wrong? Keycloak 1.7.0.Final
--
Harold Campbell
A farmer with extremely prolific hens posted the following sign. "Free
Chickens. Our Coop Runneth Over."
More information about the keycloak-user
mailing list