Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Liquibase spring weblogic support

$
0
0
Hi guys,

I created a modifies SpringLiquibase instance with the following modifications, because in weblogic the application can't find the selected classes in the zip file.

SpringResourceOpener:
      isPrefixPresent method: added
  1.  || file.matches("^.+:.+") 
to the list to catch other prefixes because classpath*: not recognized

modified ClassLoaderResourceAccessor list method:

The original contains these code:
  1.   if (!fileUrls.hasMoreElements() && (path.startsWith("jar:") || path.startsWith("file:"))) {
                fileUrls = new Vector<URL>(Arrays.asList(new URL(path))).elements();
            }
But this is wrong in weblogic... in weblogic it's start with zip: so the correct code is
  1.  if (!fileUrls.hasMoreElements() && (path.startsWith("jar:") || path.startsWith("file:")) || path.startsWith("zip:")) {
                    fileUrls = new Vector<>(Arrays.asList(new URL(path))).elements();
                }
(Suprise: in the while cycle the application watch the zip: prefix, but it's not added like a jar ;))


Still in the list method the jar file processing maybe wrong (especially in weblogic):
- When the path start jar, wsjar or zip liquibase try to find the files, but it's wrong. Here is the original code
  1.                 JarFile zipfile = new JarFile(zipFilePath, false);

                    try {
                        Enumeration<JarEntry> entries = zipfile.entries();
                        while (entries.hasMoreElements()) {
                            JarEntry entry = entries.nextElement();

                            if (entry.getName().startsWith(path)) {
Here the path is start with zip:.... or jar:....and the JarEntry.getName return the name inside of the jar.
example:

path =>  zip:C:/Oracle/Oracle_Home/user_projects/domains/test/servers/AdminServer/tmp/_WL_user/Gradle___hu_tsystems_molcc___molocc-backend-ear_ear_v20171124-1514/cw1bp9/war/WEB-INF/lib/hu.tsystems.molcc-molocc-interface-1.4.0-SNAPSHOT.jar!/META-INF/liquibase/

entry.getName() => META-INF/liquibase/

My solution:

  1.                     JarFile zipfile = new JarFile(zipFilePath, false);
                        String internalPath = zipAndFile[1];
                        try {
                            Enumeration<JarEntry> entries = zipfile.entries();
                            while (entries.hasMoreElements()) {
                                JarEntry entry = entries.nextElement();

                                if (("/"+entry.getName()).startsWith(internalPath)) {
Can you check this?

Thanks

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>