Index: admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GFLauncher.java =================================================================== --- admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GFLauncher.java (revision 44807) +++ admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/GFLauncher.java (working copy) @@ -52,7 +52,6 @@ import com.sun.enterprise.universal.xml.MiniXmlParserException; import com.sun.enterprise.util.OS; import com.sun.enterprise.util.io.FileUtils; -import com.sun.enterprise.util.net.NetUtils; import com.sun.enterprise.universal.glassfish.ASenvPropertyReader; import com.sun.enterprise.universal.xml.MiniXmlParser; import static com.sun.enterprise.util.SystemPropertyConstants.*; @@ -158,6 +157,7 @@ javaConfig = new JavaConfig(parser.getJavaConfig()); setupProfilerAndJvmOptions(parser); setupUpgradeSecurity(); + renameOsgiCache(); setupMonitoring(parser); sysPropsFromXml = parser.getSystemProperties(); asenvProps.put(INSTANCE_ROOT_PROPERTY, getInfo().getInstanceRootDir().getPath()); @@ -693,6 +693,22 @@ } } + private void renameOsgiCache() throws GFLauncherException { + if (info.isUpgrade()) { + File osgiCacheDir = new File(info.getDomainRootDir(), + "osgi-cache"); // need to check this + File backupOsgiCacheDir = new File(info.getDomainRootDir(), + "osgi-cache-" + System.currentTimeMillis()); + if (osgiCacheDir.exists() && !backupOsgiCacheDir.exists()) { + if (!FileUtils.renameFile(osgiCacheDir, backupOsgiCacheDir)) { + throw new GFLauncherException(strings.get("rename_osgi_cache_failed", osgiCacheDir, backupOsgiCacheDir)); + } else { + GFLauncherLogger.info("rename_osgi_cache_succeeded", osgiCacheDir, backupOsgiCacheDir); + } + } + } + } + private void setupMonitoring(MiniXmlParser parser) throws GFLauncherException { // As usual we have to be very careful. Index: admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/LocalStrings.properties =================================================================== --- admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/LocalStrings.properties (revision 44807) +++ admin/launcher/src/main/java/com/sun/enterprise/admin/launcher/LocalStrings.properties (working copy) @@ -84,3 +84,8 @@ copy_server_policy=Will copy glassfish/lib/templates/server.policy file to domain before upgrading. copy_server_policy_error=Could not copy server.policy to domain. You may need to turn off the \ security manager before upgrading.\nCause: {0} + +#issue 15772 +rename_osgi_cache_failed=Failed to rename OSGi persistence store from {0} to {1} +rename_osgi_cache_succeeded=Renamed OSGi persistence store from {0} to {1} +