code: private static List getTomcatPaths()
      {
          String tomcatPath = System.getProperty("catalina.home");
          if (tomcatPath == null)
          {
              //not running Tomcat
              return null;
          }
          String commonClasspath = System.getProperty("common.loader");
          if (commonClasspath == null)
          {
              //didn't find the common classpath
              return null;
          }
          StringBuffer buffer = new StringBuffer(commonClasspath);
          String pathDeclaration = "${catalina.home}";
          int length = pathDeclaration.length();
          boolean doneReplace = false;
          do
          {
              int start = commonClasspath.indexOf(pathDeclaration);
              if (start >= 0)
              {
                  buffer.replace(start, (start + length), tomcatPath);
                  commonClasspath = buffer.toString();
              }
              else
              {
                  doneReplace = true;
              }
          }
          while (!doneReplace);
          String[] paths = commonClasspath.split(",");
  
          List pathList = new ArrayList(paths.length);
          for (int i = 0; i < paths.length; i++) {
              String path = paths[i];
              pathList.add(getCanonicalPath(path));
          }
          return pathList;
      }
docs: If the system is running on Tomcat, this method will parse the
  <code>common.loader</code> property to reach deeper into the
  classpath to get Tomcat common paths
  
  @return a list of paths or null if tomcat paths not found