diff --git a/portal-impl/src/com/liferay/portal/dao/orm/hibernate/SessionFactoryImpl.java b/portal-impl/src/com/liferay/portal/dao/orm/hibernate/SessionFactoryImpl.java
index 05b3a4434b206643f5797de9e8217881f5fe0296..1b2f7087190c4a43abed8b6f53f3cae7fb23d3a1 100644
--- a/portal-impl/src/com/liferay/portal/dao/orm/hibernate/SessionFactoryImpl.java
+++ b/portal-impl/src/com/liferay/portal/dao/orm/hibernate/SessionFactoryImpl.java
@@ -38,6 +38,14 @@ import org.hibernate.engine.SessionFactoryImplementor;
  */
 public class SessionFactoryImpl implements SessionFactory {
 
+	public void afterPropertiesSet() {
+		if (_sessionFactoryClassLoader != null) {
+			return;
+		}
+
+		setSessionFactoryClassLoader(getDefaultSessionFactoryClassLoader());
+	}
+
 	@Override
 	public void closeSession(Session session) throws ORMException {
 		if ((session != null) &&
@@ -118,6 +126,10 @@ public class SessionFactoryImpl implements SessionFactory {
 		_sessionFactoryImplementor = sessionFactoryImplementor;
 	}
 
+	protected ClassLoader getDefaultSessionFactoryClassLoader() {
+		return PortalClassLoaderUtil.getClassLoader();
+	}
+
 	protected Map<String, Class<?>> getPreloadClassLoaderClasses() {
 		try {
 			Map<String, Class<?>> classes = new HashMap<>();