Lin also found https://issues.apache.org/jira/browse/GERONIMO-3387. I guess it affects a small number of cases (.war file without web.xml embedded in .ear file) but it's something it's supposed to work in Java EE 5.
Jarek On 8/8/07, David Jencks <[EMAIL PROTECTED]> wrote: > The plugin installer has an odd interpretation of where to copy files > into the server that I think would be good to fix before 2.0 gets > out. I've already fixed it in branches 2.0 and trunk. See > GERONIMO-3385 > > This changes the behavior of the plugin installer so it might be a > good idea to have the new behavior in 2.0 to avoid backward > compatibility problems in the future. > > To apply to the 2.0.0 > > svn merge -r 563591: 563592 https://svn.apache.org/repos/asf/geronimo/ > server/branches/2.0 . > > There are 3 changes: > - trim source file so it can be turned into a file :-) > - don't prepend "var/" to the target directory > - create the target directory if it doesn't already exist. > > This only affects the plugin installer which isn't used in any of our > tests. > > thanks > david jencks > > Here's the diff for easy reference: > > Modified: > geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java > geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginMetadata.java > > Modified: geronimo/server/branches/2.0/modules/geronimo-system/src/ > main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java > URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/ > modules/geronimo-system/src/main/java/org/apache/geronimo/system/ > plugin/PluginInstallerGBean.java? > view=diff&rev=563592&r1=563591&r2=563592 > ======================================================================== > ====== > --- geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java > (original) > +++ geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Tue > Aug 7 10:50:04 2007 > @@ -802,17 +802,20 @@ > monitor.getResults().setCurrentFile(data.getSourceFile()); > monitor.getResults().setCurrentMessage("Copying > "+data.getSourceFile()+" from plugin to Geronimo installation"); > Set set; > + String sourceFile = data.getSourceFile().trim(); > try { > - set = configStore.resolve(configID, null, > data.getSourceFile()); > + set = configStore.resolve(configID, null, sourceFile); > } catch (NoSuchConfigException e) { > log.error("Unable to identify module "+configID+" > to copy files from"); > throw new IllegalStateException("Unable to identify > module "+configID+" to copy files from", e); > } > if(set.size() == 0) { > - log.error("Installed configuration into repository > but cannot locate file to copy "+data.getSourceFile()); > + log.error("Installed configuration into repository > but cannot locate file to copy "+sourceFile); > continue; > } > - File targetDir = data.isRelativeToVar() ? > serverInfo.resolveServer("var/"+data.getDestDir()) : > serverInfo.resolve(data.getDestDir()); > + File targetDir = data.isRelativeToServer() ? > serverInfo.resolveServer(data.getDestDir()) : serverInfo.resolve > (data.getDestDir()); > + > + createDirectory(targetDir); > if(!targetDir.isDirectory()) { > log.error("Plugin install cannot write file > "+data.getSourceFile()+" to "+data.getDestDir()+" because > "+targetDir.getAbsolutePath()+" is not a directory"); > continue; > @@ -843,6 +846,15 @@ > } > } > > + private static void createDirectory(File dir) throws IOException { > + if (dir != null && !dir.exists()) { > + boolean success = dir.mkdirs(); > + if (!success) { > + throw new IOException("Cannot create directory " + > dir.getAbsolutePath()); > + } > + } > + } > + > private void copyFile(InputStream in, FileOutputStream out) > throws IOException { > byte[] buf = new byte[4096]; > int count; > @@ -1919,7 +1931,7 @@ > for (int i = 0; i < data.getFilesToCopy().length; i++) { > PluginMetadata.CopyFile file = data.getFilesToCopy()[i]; > Element copy = doc.createElement("copy-file"); > - copy.setAttribute("relative-to", file.isRelativeToVar > () ? "server" : "geronimo"); > + copy.setAttribute("relative-to", file.isRelativeToServer > () ? "server" : "geronimo"); > copy.setAttribute("dest-dir", file.getDestDir()); > copy.appendChild(doc.createTextNode(file.getSourceFile > ())); > config.appendChild(copy); > > Modified: geronimo/server/branches/2.0/modules/geronimo-system/src/ > main/java/org/apache/geronimo/system/plugin/PluginMetadata.java > URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/ > modules/geronimo-system/src/main/java/org/apache/geronimo/system/ > plugin/PluginMetadata.java?view=diff&rev=563592&r1=563591&r2=563592 > ======================================================================== > ====== > --- geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginMetadata.java (original) > +++ geronimo/server/branches/2.0/modules/geronimo-system/src/main/ > java/org/apache/geronimo/system/plugin/PluginMetadata.java Tue Aug 7 > 10:50:04 2007 > @@ -278,18 +278,18 @@ > } > > public static class CopyFile implements Serializable { > - private final boolean relativeToVar; // if not, relative to > the Geronimo install directory > + private final boolean relativeToServer; // if not, relative > to the Geronimo install directory > private final String sourceFile; > private final String destDir; > > - public CopyFile(boolean relativeToVar, String sourceFile, > String destDir) { > - this.relativeToVar = relativeToVar; > + public CopyFile(boolean relativeToServer, String sourceFile, > String destDir) { > + this.relativeToServer = relativeToServer; > this.sourceFile = sourceFile; > this.destDir = destDir; > } > > - public boolean isRelativeToVar() { > - return relativeToVar; > + public boolean isRelativeToServer() { > + return relativeToServer; > } > > public String getSourceFile() { > > > >
