<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&#39;s probably why it doesn&#39;t work. Try deploying as a module instead as that&#39;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">&lt;<a href="mailto:hcamp@muerte.net" target="_blank">hcamp@muerte.net</a>&gt;</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>
&gt; At the moment when the provider is specified in keycloak-server.json<br>
&gt; we only load that one provider. If you only need to use the<br>
&gt; EntityManagerFactory within your user federation provider you don&#39;t<br>
&gt; need a JpaConnectionProvider at all. Just create the<br>
&gt; EntityManagerFactory within your UserFederationProviderFactory. <br>
<br>
</span>I&#39;m trying to do exactly that, but can&#39;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&lt;String, Object&gt; props = new HashMap&lt;&gt;();<br>
                props.put(AvailableSettings.PROVIDER, &quot;org.hibernate.jpa.HibernatePersistenceProvider&quot;);<br>
                props.put(AvailableSettings.TRANSACTION_TYPE, &quot;RESOURCE_LOCAL&quot;);<br>
                props.put(&quot;jboss.as.jpa.managed&quot;, &quot;false&quot;);<br>
                emFactory = Persistence.createEntityManagerFactory(&quot;XXXXX&quot;, props);<br>
        }<br>
<br>
This same persistence unit works just fine when bundled on it&#39;s own<br>
within a normal JEE EAR.<br>
<br>
Any idea what I&#39;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.  &quot;Free<br>
Chickens.  Our Coop Runneth Over.&quot;<br>
<br>
</font></span></blockquote></div><br></div>