Bug #7211
closedMetacat sets a wrong default value for the deploy path during the totally fresh installation
0%
Description
Matt reported: I’ve noticed that when run from scratch, the metacat /admin utility seems to tack the /webapps/metacat onto the deployDir property, and I always have to change it. SO I think that is an admin utility bug on a totally clean deployment (i.e., with no backup directory in place).
so, this arises with clean deploys from docker and the like.
Files
Related issues
Updated by Jing Tao about 7 years ago
I can't reproduce the bug. In mn-demo-5, I removed/backed up /var/metacat directory. So during the configuration, I was asked to input the backup directory. I created the /var/metacat directory and input /var/metadata/.metadata as the backup directory. However, my configuration still showed the deploy directory is "/var/lib/tomcat7/webapps", there is no extra "metacat". Please see the attachment.
I also looked at code:
public static String discoverDeployDir(HttpServletRequest request) {
ServletContext servletContext = request.getSession()
.getServletContext();
String realPath = servletContext.getRealPath(".");
String contextPath = request.getContextPath();
Pattern pattern = Pattern.compile(contextPath + "/\\.$");
Matcher matcher = pattern.matcher(realPath);
if (matcher.find()) {
realPath = matcher.replaceFirst("");
}
return realPath;
}
This method guess the deploy directory base on the request object. It shouldn't have the extra "metacat" if the context value is correctly detected.
Updated by Jing Tao about 7 years ago
- Has duplicate Bug #7214: Metacat overwrites the deployDir property added
Updated by Jing Tao about 7 years ago
- Status changed from New to Closed
The issue turns out to be Tomcat 8 has change the format of current path.
In Tomcat 7, it was /opt/local/share/java/tomcat7/webapps/metacat/.
But in Tomcat 8, it is /opt/local/share/java/tomcat8/webapps/metacat
So the fancy pattern match doesn't work.
Since we just want to remove the context part, I used the old lastIndexOf and substring method in the String class. It worked well.
Updated by Jing Tao about 7 years ago
The fix has been committed to both 2.8 branch and trunk.
Updated by Jing Tao about 7 years ago
- Target version changed from 2.9.0 to 2.8.6