Changeset 35637 for main/trunk
- Timestamp:
- 2021-10-20T10:38:44+13:00 (2 years ago)
- Location:
- main/trunk/gli/src/org/greenstone/gatherer/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java
r32050 r35637 62 62 public void run() 63 63 { 64 65 64 ///System.err.println("**** GS3 server : " + _ant_command); 66 65 66 // NOTE on the use of 'noclasspath' 67 // 68 // The inclusion of the '-noclasspath' flag is to avoid the ant bash/bat script finding the ant.jar in 69 // Greenstone's web/WEB-INF area which ends up on CLASSPATH as a consequence of gs3-setup being run, 70 // which -- because that ant.jar file was produced by an older JDK -- then messes up our build.xml test for 71 // the version of java being using. The test ends up being told the java version is 1.7, even if we are 72 // running a JDK8 or above! 73 // 74 // In more detail ... 75 // The ant.jar file we have in web/WEB-INF is from an ant v1.8.2 install make with a JDK7, and has the 76 // undesirable side affect of changing the Java properties for 'ant.version' and 'ant.java.version'. In the 77 // case of the latter (ant.java.version = 1.7), this then means that when -- in our top-level build.xml 78 // file -- we test to make sure we are running a JDK8 or better, we get the answer 1.7 and so fail-out at that 79 // point (even though our JDK is newer than this). 80 // 81 // We get the problem in gli because gs3-setup.sh is run before the Java code is launched, which then goes 82 // on to run 'ant'. By this point CLASSPATH has been set, containing ant.jar. You don't necessarily see the 83 // problem running things like 'ant start' and 'ant stop' on the command line, as 'ant' is already running 84 // before build.xml triggers the sourcing of gs3-setup.bash. 85 86 67 87 SafeProcess p = null; 68 88 if (Utility.isWindows()) { … … 73 93 // The path in quotes, and the entire sequence of commands in quotes as well 74 94 // E.g. the following works in a Runtime.exec() call: 75 // cmd /C "cd "C:\path\to\greenstone3" && ant stop"95 // cmd /C "cd "C:\path\to\greenstone3" && ant -noclasspath stop" 76 96 // and it preserves any spaces in the path to GSDL3SRCHOME (_gsdl3_src_path). 77 p = new SafeProcess("cmd /C \"cd \"" + _gsdl3_src_path + File.separator + "\" && ant " + _ant_command + "\"");97 p = new SafeProcess("cmd /C \"cd \"" + _gsdl3_src_path + File.separator + "\" && ant -noclasspath " + _ant_command + "\""); 78 98 } 79 99 else { … … 81 101 _ant_command = "restart"; 82 102 } 83 p = new SafeProcess(new String[]{"/bin/bash", "-c", "ant " + _ant_command + " -f \"" + _gsdl3_src_path + File.separator + "build.xml\""});103 p = new SafeProcess(new String[]{"/bin/bash", "-c", "ant -noclasspath " + _ant_command + " -f \"" + _gsdl3_src_path + File.separator + "build.xml\""}); 84 104 } 85 105 … … 103 123 104 124 if(result != 0) { 105 System.err.println(" ****Failed to successfully " + _ant_command + " the GS3 server.");125 System.err.println("Error: Failed to successfully " + _ant_command + " the GS3 server."); 106 126 } 107 127 ///else { … … 122 142 SafeProcess p = null; 123 143 if (Utility.isWindows()) { 124 // cmd /C "cd "C:\path\to\greenstone3" && ant stop"125 p = new SafeProcess("cmd /C \"cd \"" + Configuration.gsdl3_src_path + File.separator + "\" && ant stop\"");144 // cmd /C "cd "C:\path\to\greenstone3" && ant -noclasspath stop" 145 p = new SafeProcess("cmd /C \"cd \"" + Configuration.gsdl3_src_path + File.separator + "\" && ant -noclasspath stop\""); 126 146 } else { 127 p = new SafeProcess(new String[]{"/bin/bash", "-c", "ant stop -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""});147 p = new SafeProcess(new String[]{"/bin/bash", "-c", "ant -noclasspath stop -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""}); 128 148 } 129 149 … … 151 171 152 172 public static boolean isServerRunning() { 153 String antCmd = "ant verbose-check-tomcat-running";173 String antCmd = "ant -noclasspath verbose-check-tomcat-running"; 154 174 155 175 SafeProcess p = null; -
main/trunk/gli/src/org/greenstone/gatherer/util/SafeProcess.java
r33403 r35637 291 291 if(this.command != null) { 292 292 log("SafeProcess running: " + command); 293 DebugStream.println(" SafeProcess running: " + command); 294 293 295 prcs = rt.exec(this.command); 294 296 } … … 302 304 } 303 305 log("SafeProcess running: [" + cmdDisplay + "]"); 306 DebugStream.println(" SafeProcess running: [" + cmdDisplay + "]"); 307 304 308 cmdDisplay = null; // let the GC have it 305 309
Note:
See TracChangeset
for help on using the changeset viewer.