<div dir="ltr">Are you deploying it as a module or by dropping it into standalone/configuration/providers? The latter will pick up the persistence.xml from Keycloak classloader so that's probably why it doesn't work. Try deploying as a module instead as that's the only way you can get full control of the classpath</div><div class="gmail_extra"><br><div class="gmail_quote">On 6 January 2016 at 01:00, Harold Campbell <span dir="ltr"><<a href="mailto:hcamp@muerte.net" target="_blank">hcamp@muerte.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, 2015-11-11 at 14:12 +0100, Stian Thorgersen wrote:<br>
> At the moment when the provider is specified in keycloak-server.json<br>
> we only load that one provider. If you only need to use the<br>
> EntityManagerFactory within your user federation provider you don't<br>
> need a JpaConnectionProvider at all. Just create the<br>
> EntityManagerFactory within your UserFederationProviderFactory. <br>
<br>
</span>I'm trying to do exactly that, but can't for the life of me get the<br>
EntityManagerFactory to create. It fails with:<br>
<br>
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named XXXXX<br>
<br>
Before that, I also see this warning even if I explicitly pass the suggested provider as a property:<br>
<br>
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.<br>
<br>
The persistence.xml is in META-INF. I also tried META-INF/classes/META-<br>
INF.<br>
<br>
My init code:<br>
<br>
private void lazyInit() {<br>
Map<String, Object> props = new HashMap<>();<br>
props.put(AvailableSettings.PROVIDER, "org.hibernate.jpa.HibernatePersistenceProvider");<br>
props.put(AvailableSettings.TRANSACTION_TYPE, "RESOURCE_LOCAL");<br>
props.put("jboss.as.jpa.managed", "false");<br>
emFactory = Persistence.createEntityManagerFactory("XXXXX", props);<br>
}<br>
<br>
This same persistence unit works just fine when bundled on it's own<br>
within a normal JEE EAR.<br>
<br>
Any idea what I'm doing wrong? Keycloak 1.7.0.Final<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Harold Campbell<br>
<br>
A farmer with extremely prolific hens posted the following sign. "Free<br>
Chickens. Our Coop Runneth Over."<br>
<br>
</font></span></blockquote></div><br></div>