Community
Participate
Working Groups
Build Identifier: Indigo SR1 ServerInstance.getContextFilePath() fails to calculate correct context file path for multi level context roots. It doesn't correctly replace '/' with '#'. This problem results in orphaned context roots finding their way in the conf/Catalina/localhost directory after TomcatConfiguration.cleanupServer() invocation. This problem requires a clean of the server to fix it. Here is a possible simple patch: public IPath getContextFilePath(IPath baseDir, Context context) { if (context == null) throw new IllegalArgumentException(Messages.errorXMLNullContextArg); status = Status.OK_STATUS; if (host == null && getHost() == null) return null; IPath contextFilePath = null; IPath contextDir = getContextXmlDirectory(baseDir.append("conf")); String name = context.getPath(); if (name != null) { if (name.startsWith("/")) name = name.substring(1); if (name.length() == 0) name = "ROOT"; name.replaceAll("/", "#"); //Support multi level context roots. contextFilePath = contextDir.append(name + ".xml"); } else { // TODO Set error status } return contextFilePath; } Reproducible: Always Steps to Reproduce: 1. Create a Tomcat Server. 2. Enable Publish Module Context separately 3. Add a web project with a multi level context root (e.g. some/path) 4. Look at the publish location for this server. Notice a context xml file in conf/Catalina/localhost (e.g. some#path.xml) 5. Change the context root through the Server Properties->Modules tab. (e.g. some/path2) 6. Look in published location. Note that the some#path.xml file is still there.
Sorry forgot to detail that this is an issue with the Tomcat Server Adapter.
org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance.getContextFilePath()