Buggy code:
public class DefaultPersistenceUnitManager implements InitializingBean , ResourceLoaderAware , LoadTimeWeaverAware , PersistenceUnitManager { public static final String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF//persistence.xml" ; public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:" ; private static final boolean jpa2ApiPresent = ClassUtils . hasMethod ( PersistenceUnitInfo . class , "getSharedCacheMode" ) ; private String [ ] persistenceXmlLocations = new String [ ] { DefaultPersistenceUnitManager . DEFAULT_PERSISTENCE_XML_LOCATION } ; private String defaultPersistenceUnitRootLocation = DefaultPersistenceUnitManager . ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION ; private DataSourceLookup dataSourceLookup = new JndiDataSourceLookup ( ) ; private DataSource defaultDataSource ; private PersistenceUnitPostProcessor [ ] persistenceUnitPostProcessors ; private LoadTimeWeaver loadTimeWeaver ; private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver ( ) ; private final Set < String > persistenceUnitInfoNames = new HashSet < String > ( ) ; private final Map < String , PersistenceUnitInfo > persistenceUnitInfos = new HashMap < String , PersistenceUnitInfo > ( ) ; public void setPersistenceXmlLocation ( String persistenceXmlLocation ) { } public void setPersistenceXmlLocations ( String [ ] persistenceXmlLocations ) { } public void setDefaultPersistenceUnitRootLocation ( String defaultPersistenceUnitRootLocation ) { } public void setDataSources ( Map < String , DataSource > dataSources ) { } public void setDataSourceLookup ( DataSourceLookup dataSourceLookup ) { } public DataSourceLookup getDataSourceLookup ( ) { } public void setDefaultDataSource ( DataSource defaultDataSource ) { } public DataSource getDefaultDataSource ( ) { } public void setPersistenceUnitPostProcessors ( PersistenceUnitPostProcessor [ ] postProcessors ) { } public PersistenceUnitPostProcessor [ ] getPersistenceUnitPostProcessors ( ) { } public void setLoadTimeWeaver ( LoadTimeWeaver loadTimeWeaver ) { } public LoadTimeWeaver getLoadTimeWeaver ( ) { } public void setResourceLoader ( ResourceLoader resourceLoader ) { } public void afterPropertiesSet ( ) { } public void preparePersistenceUnitInfos ( ) { } private SpringPersistenceUnitInfo [ ] readPersistenceUnitInfos ( ) { } private URL determineDefaultPersistenceUnitRootUrl ( ) { } protected final MutablePersistenceUnitInfo getPersistenceUnitInfo ( String persistenceUnitName ) { PersistenceUnitInfo pui = this . persistenceUnitInfos . get ( persistenceUnitName ) ; <START_BUG> if ( Proxy . isProxyClass ( pui . getClass ( ) ) ) { <END_BUG> DefaultPersistenceUnitManager . Jpa2PersistenceUnitInfoDecorator dec = ( ( DefaultPersistenceUnitManager . Jpa2PersistenceUnitInfoDecorator ) ( Proxy . getInvocationHandler ( pui ) ) ) ; return dec . getTarget ( ) ; } else { return ( ( MutablePersistenceUnitInfo ) ( pui ) ) ; } } protected void postProcessPersistenceUnitInfo ( MutablePersistenceUnitInfo pui ) { } public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo ( ) { } public PersistenceUnitInfo obtainPersistenceUnitInfo ( String persistenceUnitName ) { } private static class Jpa2PersistenceUnitInfoDecorator implements InvocationHandler { private final SpringPersistenceUnitInfo target ; private final Class < ? extends Enum > sharedCacheModeEnum ; private final Class < ? extends Enum > validationModeEnum ; @ SuppressWarnings ( "unchecked" ) public Jpa2PersistenceUnitInfoDecorator ( SpringPersistenceUnitInfo target ) { } public final SpringPersistenceUnitInfo getTarget ( ) { } public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } } }

Fix:
if ( ( pui != null ) && ( Proxy . isProxyClass ( pui . getClass ( ) ) ) ) {