If we try to use a service with one of it's non-public constructors the result is null and does not tell the underlaying cause for this error:
(...)
public class PersistenceUnitFactoryImpl implements PersistenceUnitFactory,Closeable{
private final String persistenceUnit;
private final EntityManagerFactory factory;
PersistenceUnitFactoryImpl(final String _persistenceUnit){
try{
this.persistenceUnit=_persistenceUnit;
this.factory=createEntityManagerFactory(Collections.emptyMap());
}catch(Throwable e){
System.err.println("Error initiallizing persistenceUnit: "+e.getMessage());
e.printStackTrace();
throw e;
}
}
(...)
This could not look like so important, but it's necessary in order to find easily the initialization error cause.