I've noticed a bug in the
Class which results in two instances of the
to be available at runtime (as well as the deprecated ejb instance, which is always move to first position).
I've highlighted the lines which cause the problem Persistence Proivder
During execution under Java 7, the implementation of hash set results in an iteration over the list of providers in the META-INF/services file which has the org.hibernate.ejb.HibernatePersistence first, which avoid the bug.
In Java 8 this order has changed and results in the org.hibernate.jpa.HibernatePersistenceProvider being the first item in the iterator.
The duplicate is added if the org.hibernate.jpa.HibernatePersistenceProvider is the first element in the iterator, as this then passes the condition to manage the org.hibernate.ejb.HibernatePersistence to be first in the list. This is where the extra is added, as all that is needed to complete correctly and force the ejb version to be first is line 148. Line 149 adds a copy of the binding previously at position 0 at the end of the list. Lines 147 & 149 should be removed to resolve the problem.
Java 8, Hibernate 4.3.6.Final, jpa-2.1-1.0.0