diff --git a/modules/core/src/com/haulmont/cuba/core/sys/persistence/OrmXmlAwareClassLoader.java b/modules/core/src/com/haulmont/cuba/core/sys/persistence/OrmXmlAwareClassLoader.java index 0c5a0a1ced..4e0781bcdb 100644 --- a/modules/core/src/com/haulmont/cuba/core/sys/persistence/OrmXmlAwareClassLoader.java +++ b/modules/core/src/com/haulmont/cuba/core/sys/persistence/OrmXmlAwareClassLoader.java @@ -17,10 +17,12 @@ package com.haulmont.cuba.core.sys.persistence; +import com.google.common.base.Strings; import com.haulmont.cuba.core.sys.AppContext; import org.springframework.util.ClassUtils; import javax.annotation.Nullable; +import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -28,6 +30,7 @@ import java.net.URLClassLoader; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.security.CodeSource; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; @@ -61,7 +64,7 @@ public class OrmXmlAwareClassLoader extends URLClassLoader { @Nullable protected URL getOrmXmlUrl(String name) { - if (name.equals("orm.xml")) { + if ("orm.xml".equals(name)) { Path path = Paths.get(workDir, name); if (Files.exists(path)) { try { @@ -71,6 +74,13 @@ public class OrmXmlAwareClassLoader extends URLClassLoader { } } } + boolean isUberJar = Boolean.parseBoolean(AppContext.getProperty("cuba.uberJar")); + if ("".equals(name) && isUberJar) { + CodeSource codeSource = getClass().getProtectionDomain().getCodeSource(); + if (codeSource != null) { + return codeSource.getLocation(); + } + } return null; } } \ No newline at end of file diff --git a/modules/core/src/cuba-spring.xml b/modules/core/src/cuba-spring.xml index 91372be23e..a802628bad 100644 --- a/modules/core/src/cuba-spring.xml +++ b/modules/core/src/cuba-spring.xml @@ -45,7 +45,6 @@ -