}
public AbstractJPAConnectionFactory(String entityManagerFactoryName, Map<String, Object> properties) {
Thread thread = Thread.currentThread();
ClassLoader oldClassLoader = thread.getContextClassLoader();
SysPropApplicationContextLoader context = SpringInit.CONTEXT;
try {
// check if we are loading from spring, and if so, apply the workaround for
// Axis and Spring class loading otherwise classes needed for dynamic loading are not found
if (context != null) {
log.info("Using context file:" + context.getApplicationContextFile());
thread.setContextClassLoader(context.getClass().getClassLoader());
}
initDatasourceIfNeeded(properties);
initEM(entityManagerFactoryName, properties);
} catch (Exception e) {