Index: /gs3-extensions/solr/trunk/src/bin/script/run_solr_server.pl
===================================================================
--- /gs3-extensions/solr/trunk/src/bin/script/run_solr_server.pl	(revision 29711)
+++ /gs3-extensions/solr/trunk/src/bin/script/run_solr_server.pl	(revision 29711)
@@ -0,0 +1,95 @@
+#!/usr/bin/perl -w
+
+###########################################################################
+#
+# run_solr_server.pl -- perl script that uses solrserver.pm to stop and
+# start the jetty server included with the solr extension for Greenstone3.
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 2012 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+# For easily starting and stopping the jetty server (that is included with 
+# the solr extension for Greenstone 3) from the command-line.
+# First source gs3-setup.sh, then this script can be run as follows:
+#     run_solr_server.pl start
+# which runs the jetty server. 
+# To stop the jetty server, re-run the script with the stop parameter:
+#     run_solr_server.pl stop
+
+
+BEGIN {
+    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
+    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
+    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
+
+    die "GEXT_SOLR not set\n" unless defined $ENV{'GEXT_SOLR'};
+    my $solr_ext = $ENV{'GEXT_SOLR'};
+    unshift (@INC, "$solr_ext/perllib");
+}
+
+use strict;
+use util;
+#use solrutil;
+use solrserver;
+
+sub print_usage {
+    print STDERR "\nUsage:\t$0 start\n\t$0 stop\n\n";
+    exit 1;
+}
+
+sub main
+{
+  my (@argv) = @_;
+  my $argc = scalar(@argv);
+
+  # defaults and fall-backs
+  my $verbosity = 2;
+  my $command = "stop";
+  #my $stopkey = "standalone-greenstone-solr";
+
+  
+  if ($argc < 1 || $argc > 2) {
+      print_usage();
+  }
+
+  if($argv[0] ne "start" && $argv[0] ne "stop") {
+      print_usage();  
+  } else {
+      $command = $argv[0]
+  }
+
+  #if($argc > 1) {
+  #    $stopkey = $argv[1];
+  #}
+  
+  my $solr_server = new solrserver();
+  #$solr_server->set_jetty_stop_key($stopkey);
+
+  if ($command eq "start") {
+      $solr_server->start($verbosity);
+  } elsif ($command eq "stop") {
+      my $options = { 'output_verbosity' => $verbosity };
+      $solr_server->stop($options);
+  }
+}
+
+
+&main(@ARGV);
Index: /gs3-extensions/solr/trunk/src/build.xml
===================================================================
--- /gs3-extensions/solr/trunk/src/build.xml	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/build.xml	(revision 29711)
@@ -9,9 +9,15 @@
 
   <!-- greenstone3 paths -->
-  <property name="web.home" value="${basedir}/../../web"/>
+  <!-- http://stackoverflow.com/questions/3136849/how-do-i-convert-a-relative-path-in-ant-to-an-absolute-path 
+    http://stackoverflow.com/questions/8295860/pathconvert-with-relative-file-names -->
+  <property name="web.home" location="${basedir}/../../web"/> <!-- location property creates an absolute path -->
   <property name="localsite.collectdir" value="${web.home}/sites/localsite/collect"/>
   <property name="web.classesdir" value="${web.home}/WEB-INF/classes"/>
   <property name="web.libdir" value="${web.home}/WEB-INF/lib"/>  
   <property name="web.extdir" value="${web.home}/ext/solr"/>
+
+  <property name="tomcat.dir" location="${basedir}/../../packages/tomcat"/> <!-- location property creates an absolute path -->
+  <property name="tomcat.lib.dir" value="${tomcat.dir}/lib"/>
+  <property name="tomcat.context.dir" value="${tomcat.dir}/conf/Catalina/localhost"/>
 
   <path id="compile.classpath">
@@ -25,5 +31,7 @@
       <include name="*.jar"/>
     </fileset>
+    <pathelement location="lib/servlet-api-3.0.jar"/>
   </path>
+
 
   <!-- FILE LISTINGS.-->
@@ -149,8 +157,49 @@
     <echo>Unzipping pre-built index</echo>
     <unzip dest="${localsite.collectdir}/solr-jdbm-demo" src="${localsite.collectdir}/solr-jdbm-demo/index.zip" />
-
-
-  </target>
-  
+  </target>
+
+  <!-- Setting up solr to work with tomcat server instead of jetty server -->
+  <target name="solr-for-tomcat" description="Helper-target: setting up solr to work tomcat">
+    
+    <echo>Copying solr jars needed for running solr with tomcat: ${basedir}/lib/ext</echo>	
+    <copy todir="${tomcat.lib.dir}">	  
+      <fileset dir="lib/ext">
+	<include name="*.jar"/>
+      </fileset>
+    </copy>
+    
+    <!-- slf4j and commons logging bridge needed to avoid exception about incompatibility in tomcat log files-->
+    <echo>Copying ${basedir}/lib/ext/jcl-over-slf4j-1.6.6.jar again to ${web.libdir}</echo>
+    <copy todir="${web.libdir}">
+      <filelist id="logging-bridge" dir="lib/ext" files="jcl-over-slf4j-1.6.6.jar"/>
+    </copy>	
+
+    <echo>Moving xalan related jar files from  ${web.libdir} to ${tomcat.lib.dir}, to share with solr</echo>
+    <move todir="${tomcat.lib.dir}">
+      <filelist dir="${web.libdir}">
+	<file name="xalan.jar"/>
+	<file name="xercesImpl.jar"/>
+	<file name="xml-apis.jar"/>
+	<file name="xsltc.jar"/>
+	<file name="serializer.jar"/>
+      </filelist>
+    </move>
+    
+    <echo>Copying ${basedir}/webapps/solr.war to ${tomcat.dir}/webapps</echo>
+    <copy todir="${tomcat.dir}/webapps" file="webapps/solr.war" />
+    <echo>Generating solr context file in ${tomcat.context.dir}</echo>
+    
+    <!-- we want unix paths (forward slashes) in the tomcat context file -->
+    <pathconvert targetos="unix" property="gsdl3.web.home">
+      <path path="${web.home}"/><!-- creates an absolute path-->
+    </pathconvert>
+    <pathconvert targetos="unix" property="tomcat.home">
+      <path path="${tomcat.dir}"/><!-- creates an absolute path-->
+    </pathconvert>
+    <filter token="gsdl3home" value="${gsdl3.web.home}"/>
+    <filter token="tomcathome" value="${tomcat.home}"/>
+    <copy file="solr-tomcat-context.xml.in" tofile="${tomcat.context.dir}/solr.xml" filtering="true" overwrite="true"/>
+
+  </target>  
 
   <!-- copy the content of the web folder (avoiding the top-level .svn directory) -->
@@ -165,17 +214,17 @@
   </target>
 
-  <target name="add-service" depends="copy-solr-web,copy-files,compile" description="Run this target to setup the Solr extension for Greenstone3" />
-
-  
-  <target name="del-service" 
-	description="Run this target to unset the Solr extension for Greenstone3">	
-	
+
+  <target name="add-service" depends="copy-solr-web,copy-files,solr-for-tomcat,compile" description="Run this target to setup the Solr extension for Greenstone3" />
+  
+  <target name="del-service" depends="del-files,del-solr-for-tomcat"
+	description="Run this target to unset the Solr extension for Greenstone3" />
+
+
+  <target name="del-files" description="Helper-target to delete files for del-service target">
 	<!-- failonerror is set to false in case some files don't exist 
 	and can't be deleted therefore -->
-	
-
-
-	<echo/>
-	<echo>Removing from  gsdl3 properties area: properties/${property-files}</echo>
+
+	<echo/>
+	<echo>Removing from gsdl3 properties area: properties/${property-files}</echo>
 	<delete failonerror="false">
           <filelist dir="${web.classesdir}" files="${property-files}"/>
@@ -194,6 +243,45 @@
 	<echo/>
 	<echo>Removing solr-jdbm-demo collection from: ${localsite.collectdir}</echo>
-	<delete failonerror="false" includeEmptyDirs="true" dir="${localsite.collectcdir}/solr-jdbm-demo"/>	
-	
+	<delete failonerror="false" includeEmptyDirs="true" dir="${localsite.collectcdir}/solr-jdbm-demo"/>
+
+  </target>
+  
+  <target name="del-solr-for-tomcat" description="Helper-target to remove files for getting solr to work with tomcat">
+
+	<echo/>
+	<echo>Removing solr modifications to tomcat: context file, solr.war and deployed version, jar files</echo>
+
+	<!-- Actually need to ensure tomcat is not running at this point
+	     But if solr.war is deleted first, it can't be re-deployed when deleting the solr folder subsequently
+	  -->
+	<delete failonerror="false" file="${tomcat.dir}/webapps/solr.war"/>
+	<delete failonerror="false" includeEmptyDirs="true" dir="${tomcat.dir}/webapps/solr"/>
+
+	<delete failonerror="false" file="${tomcat.context.dir}/solr.xml"/>
+
+	<!-- delete all the jar files in tomcat/lib that were copied from ext/solr/lib/ext
+	     which are all the jar files that are present in both tomcat/lib and ext/solr/lib/ext
+	     https://ant.apache.org/manual/Types/selectors.html#presentselect -->
+	<delete failonerror="false">	  
+	  <fileset dir="${tomcat.lib.dir}" includes="**/*.jar">	    
+	    <present present="both" targetdir="lib/ext"/>
+	  </fileset>
+	</delete>
+
+	<!-- remove logging bridge jar file that was added into greenstone 3 web lib area -->
+	<delete failonerror="false" file="${web.libdir}/jcl-over-slf4j-1.6.6.jar"/>
+
+	<!-- moving shared xalan related jar files back from tomcat lib to GS3 web lib -->
+	<move todir="${web.libdir}">
+	  <filelist dir="${tomcat.lib.dir}">
+	    <file name="xalan.jar"/>
+	    <file name="xercesImpl.jar"/>
+	    <file name="xml-apis.jar"/>
+	    <file name="xsltc.jar"/>
+	    <file name="serializer.jar"/>
+	  </filelist>
+	</move>
+
+	<!--http://stackoverflow.com/questions/2140637/how-do-i-build-a-list-of-file-names-->
   </target>
   
Index: /gs3-extensions/solr/trunk/src/gs3-setup.sh
===================================================================
--- /gs3-extensions/solr/trunk/src/gs3-setup.sh	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/gs3-setup.sh	(revision 29711)
@@ -11,4 +11,24 @@
 #--
 
+# If using tomcat, read the tomcat host and port from the toplevel GS3 build.properties
+# http://en.kioskea.net/faq/1757-how-to-read-a-file-line-by-line
+# The following sets the field separator IFS to the = sign, then reads the file line by 
+# line, setting propname and propval (which are fields separated by '=') for each line read
+SOLR_PORT=8983
+SOLR_HOST=localhost
+file=$GSDL3SRCHOME/build.properties
+while IFS== read propname propval; do
+    if [ "x$propname" = "xtomcat.server" ] ; then
+	SOLR_HOST=$propval
+    fi
+    if [ "x$propname" = "xtomcat.port" ] ; then
+	SOLR_PORT=$propval
+    fi          
+done < $file
+
+echo "Tomcat port: $SOLR_PORT"
+echo "Tomcat host: $SOLR_HOST"
+
+# If using jetty:
 # The port Jetty runs on:
 SOLR_JETTY_PORT=8983
@@ -61,4 +81,6 @@
   export SOLR_JETTY_PORT
   export JETTY_STOP_PORT
+  export SOLR_PORT
+  export SOLR_HOST
   first_time=1
 
Index: /gs3-extensions/solr/trunk/src/perllib/solrbuilder.pm
===================================================================
--- /gs3-extensions/solr/trunk/src/perllib/solrbuilder.pm	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/perllib/solrbuilder.pm	(revision 29711)
@@ -676,5 +676,5 @@
 
 
-    # Also need to stop the Solr/jetty server if it was explicitly started
+    # Also need to stop the Solr server (be it tomcat or jetty) if it was explicitly started
     # in pre_build_indexes()
     
Index: /gs3-extensions/solr/trunk/src/perllib/solrserver.pm
===================================================================
--- /gs3-extensions/solr/trunk/src/perllib/solrserver.pm	(revision 29711)
+++ /gs3-extensions/solr/trunk/src/perllib/solrserver.pm	(revision 29711)
@@ -0,0 +1,554 @@
+###########################################################################
+#
+# solrserver.pm -- class for starting and stopping the Solr with the
+# GS3 tomcat server.
+# A component of the Greenstone digital library software
+# from the New Zealand Digital Library Project at the
+# University of Waikato, New Zealand.
+#
+# Copyright (C) 1999 New Zealand Digital Library Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+###########################################################################
+
+
+package solrserver;
+
+use strict; 
+#no strict 'refs';
+
+use solrutil;
+
+sub new {
+    my $class = shift(@_);
+    my ($build_dir) = @_;
+
+    my $self = { 'build_dir' => $build_dir };
+
+    my $search_path = &solrutil::get_search_path();
+
+    $self->{'server_explicitly_started'} = undef;
+
+    my $server_port = $ENV{'SOLR_PORT'};
+    my $server_host = $ENV{'SOLR_HOST'};
+    my $base_url = "http://$server_host:$server_port/solr/";
+    my $admin_url = "http://$server_host:$server_port/solr/admin/cores";
+    
+    $self->{'base-url'} = $base_url;
+    $self->{'admin-url'} = $admin_url;
+
+    return bless $self, $class;
+}
+
+sub _wget_service
+{
+    my $self = shift (@_);
+    my ($output_format,$url,$cgi_get_args) = @_;
+
+    my $full_url = $url;
+
+    $url .= "?$cgi_get_args" if (defined $cgi_get_args);
+
+    print STDERR "\n\n**** _wget_service SOLR WEB URL: $url\n\n";
+    
+    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lion binaries (android too?)
+    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
+
+    my $cmd = "wget -O - \"$url\" 2>&1";
+
+    my $preamble_output = "";    
+    my $xml_output = "";
+    my $error_output = undef;
+
+    my $in_preamble = ($output_format eq "xml") ? 1 : 0;
+    
+##    print STDERR "**** wgetcmd = \n $cmd\n";
+
+    if (open(WIN,"$cmd |")) {
+
+	my $line;
+	while (defined ($line=<WIN>)) {
+
+	    if ($line =~ m/ERROR \d+:/) {
+		chomp $line;
+		$error_output = $line;
+		last;
+	    }
+	    elsif ($line =~ m/failed: Connection refused/) {
+		chomp $line;
+		$error_output = $line;
+		last;
+	    }
+	    elsif ($in_preamble) {
+		if ($line =~ m/<.*>/) {
+		    $in_preamble = 0;
+		}
+		else {
+		    $preamble_output .= $line;
+		}
+	    }
+
+	    if (! $in_preamble) {
+		$xml_output .= $line;
+	    }
+	}
+	close(WIN);
+
+    }
+    else {
+	$error_output = "Error: failed to run $cmd\n";
+	$error_output .= "  $!\n";
+    }
+
+    if(defined $error_output) {
+	print STDERR "\n\n**** WGET_SERVICE got an error: $error_output\n\n";
+    }
+
+    my $output = { 'url'      => $full_url,
+		   'preamble' => $preamble_output,
+		   'output'   => $xml_output,
+		   'error'    => $error_output };
+
+    return $output;
+}
+
+
+sub _base_service
+{
+    my $self = shift (@_);
+    my ($cgi_get_args) = @_;
+
+    my $base_url = $self->{'base-url'};
+
+    return $self->_wget_service("html",$base_url,$cgi_get_args);
+}
+ 
+sub _admin_service
+{
+    my $self = shift (@_);
+    my ($cgi_get_args) = @_;
+
+    my $admin_url = $self->{'admin-url'};
+
+    return $self->_wget_service("xml",$admin_url,$cgi_get_args);
+}
+
+
+sub server_running
+{
+    my $self = shift @_;
+
+    my $output = $self->_base_service();
+
+    my $have_error = defined $output->{'error'};
+
+    my $running = ($have_error) ? 0 : 1;
+
+    return $running;
+}
+
+
+sub admin_ping_core
+{
+    my $self = shift @_;
+    my ($core) = @_;
+
+    my $cgi_get_args = "action=STATUS&core=$core";
+
+    my $ping_status = 1;
+
+    my $output = $self->_admin_service($cgi_get_args);
+
+    if (defined $output->{'error'}) {
+	# severe error, such as failing to connect to the server
+	$ping_status = 0;
+
+	my $url      = $output->{'url'};
+	my $preamble = $output->{'preamble'};
+	my $error    = $output->{'error'};
+	
+	print STDERR "----\n";
+	print STDERR "Error: Failed to get XML response from:\n";
+	print STDERR "         $url\n";
+	print STDERR "Output was:\n";
+	print STDERR $preamble if ($preamble ne "");
+	print STDERR "$error\n";
+	print STDERR "----\n";
+    }
+    else {
+	
+	# If the collection doesn't exist yet, then there will be
+	# an empty element of the form:
+	#   <lst name="collect-doc"/>
+	# where 'collect' is the actual name of the collection, 
+	# such as demo
+
+	my $xml_output = $output->{'output'};
+	
+	my $empty_element="<lst\\s+name=\"$core\"\\s*\\/>";
+	
+	$ping_status = !($xml_output =~ m/$empty_element/s);
+    }
+
+    return $ping_status;
+}
+
+sub filtered_copy
+{
+    my $self = shift @_;
+
+    my $src_file = shift @_;
+    my $dst_file = shift @_;
+    my $re_substitutions = shift @_;
+
+    # $re_substitutions is a hashmap of the form: [re_key] => subst_str
+    
+    my $content = "";
+
+    if (open(FIN,'<:utf8',$src_file)) {
+
+	my $line;
+	while (defined($line=<FIN>)) {
+	    $content .= $line;
+	}
+    }
+
+    close(FIN);
+
+    # perform RE string substitutions
+    foreach my $re_key (keys %$re_substitutions) {
+
+	my $subst_str = $re_substitutions->{$re_key};
+
+	# Perform substitution of the form:
+	#  $content =~ s/$re_key/$subst_str/g;
+	# but allow allow separator char (default '/') 
+	# and flags (default 'g') to be parameterized
+
+	$content =~ s/$re_key/$subst_str/g;
+    }
+    
+    if (open(FOUT, '>:utf8', $dst_file)) {
+	print FOUT $content;
+	close(FOUT);
+    }
+    else {
+	print STDERR "Error: Failed to open file '$dst_file' for writing.\n$!\n";
+    }   
+}
+
+sub solr_xml_to_solr_xml_in
+{
+    my $self = shift @_;
+    my ($solr_xml_dir) = @_;
+    
+    my $gsdl3home = $ENV{'GSDL3HOME'};
+    
+    if (!defined $solr_xml_dir || !-d $solr_xml_dir) {
+	# if not passed in, use stored solr_live_home
+	$solr_xml_dir = $self->{'solr_live_home'};
+    }
+
+    my $solrxml_in = &util::filename_cat($solr_xml_dir, "solr.xml.in");
+    my $solrxml = &util::filename_cat($solr_xml_dir, "solr.xml");
+
+    my $gsdl3home_re = &util::filename_to_regex($gsdl3home);
+
+    my $replacement_map = { qr/$gsdl3home_re/ => "\@gsdl3home\@" };
+
+    $self->filtered_copy($solrxml,$solrxml_in,$replacement_map);
+}
+
+
+sub solr_xml_in_to_solr_xml
+{
+    my $self = shift @_;
+    my ($solr_xml_dir) = @_;
+
+    my $gsdl3home = $ENV{'GSDL3HOME'};
+    if (!defined $solr_xml_dir || !-d $solr_xml_dir) {
+	# if not passed in, use stored solr home
+	$solr_xml_dir = $self->{'solr_live_home'};
+    }
+    my $solrxml_in = &util::filename_cat($solr_xml_dir, "solr.xml.in");
+    my $solrxml = &util::filename_cat($solr_xml_dir, "solr.xml");
+    
+    my $gsdl3home_re = &util::filename_to_regex($gsdl3home);
+
+    my $replacement_map = { qr/\@gsdl3home\@/ => $gsdl3home_re };
+
+    $self->filtered_copy($solrxml_in,$solrxml,$replacement_map);
+}
+
+
+# Some of the Solr CoreAdmin API calls available. 
+# See http://wiki.apache.org/solr/CoreAdmin
+sub admin_reload_core
+{
+    my $self = shift @_;
+    my ($core) = @_;
+
+    my $cgi_get_args = "action=RELOAD&core=$core";
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+sub admin_rename_core
+{
+    my $self = shift @_;
+    my ($oldcore, $newcore) = @_;
+
+    my $cgi_get_args = "action=RENAME&core=$oldcore&other=$newcore";
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+sub admin_swap_core
+{
+    my $self = shift @_;
+    my ($oldcore, $newcore) = @_;
+
+    my $cgi_get_args = "action=SWAP&core=$oldcore&other=$newcore";
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+# The ALIAS action is not supported in our version of solr (despite it
+# being marked as experimental in the documentation for Core Admin)
+sub admin_alias_core
+{
+    my $self = shift @_;
+    my ($oldcore, $newcore) = @_;
+
+    my $cgi_get_args = "action=ALIAS&core=$oldcore&other=$newcore";
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+sub admin_create_core
+{
+    my $self = shift @_;
+    my ($core, $data_parent_dir) = @_; # data_parent_dir is optional, can be index_dir. Defaults to builddir if not provided
+
+    my ($ds_idx) = ($core =~ m/^.*-(.*?)$/);
+
+    my $cgi_get_args = "action=CREATE&name=$core";
+
+    my $collect_home = $ENV{'GSDLCOLLECTDIR'};
+    my $etc_dirname = &util::filename_cat($collect_home,"etc");
+
+    if(!defined $data_parent_dir) {
+	$data_parent_dir = $self->{'build_dir'};
+    } 
+    
+    my $idx_dirname = &util::filename_cat($data_parent_dir,$ds_idx); # "dataDir"  
+	    
+    $cgi_get_args .= "&instanceDir=$etc_dirname";
+    $cgi_get_args .= "&dataDir=$idx_dirname";
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+# removes (unloads) core from the ext/solr/sorl.xml config file
+sub admin_unload_core
+{
+    my $self = shift @_;
+    my ($core, $delete) = @_;
+
+    my $cgi_get_args = "action=UNLOAD&core=$core"; 
+    # &deleteIndex=true available from Solr3.3, see https://wiki.apache.org/solr/CoreAdmin. 
+    # Also available since later Solr versions: deleteDataDir and deleteInstanceDir
+    if(defined $delete && $delete == 1) {
+	$cgi_get_args = $cgi_get_args."&deleteIndex=true";
+    }
+
+    $self->_admin_service($cgi_get_args);
+
+}
+
+sub start
+{
+    my $self = shift @_;
+    my ($verbosity) = @_;
+    
+    $verbosity = 1 unless defined $verbosity;
+
+    my $solr_live_home    = &util::filename_cat($ENV{'GSDL3HOME'}, "ext", "solr");
+    $self->{'solr_live_home'} = $solr_live_home; # will be used later to generate solr.xml.in from solr.xml and vice-versa
+    my $server_port = $ENV{'SOLR_PORT'};
+    my $server_host = $ENV{'SOLR_HOST'};
+
+    chdir($ENV{'GSDL3SRCHOME'});
+
+    my $server_java_cmd = "ant start";
+
+    my $server_status = "unknown";
+
+    if ($self->server_running()) {
+	$server_status = "already-running";
+	print STDERR "@@@@ server already running\n\n";
+    }
+    elsif (open(STARTIN,"$server_java_cmd 2>&1 |")) {
+
+	print STDERR "@@@@ need to start tomcat\n\n";
+	print STDERR "**** starting up tomcat server with cmd start =\n $server_java_cmd\n" if ($verbosity > 1);
+
+	my $line;
+	while (defined($line=<STARTIN>)) {	   
+	
+	    #if ($line =~ m/^(BUILD FAILED/) {
+	    print "Tomcat startup: $line";
+	    #}
+	}
+	if ($self->server_running()) {
+	    $server_status = "explicitly-started";
+	    #print STDERR "\n*** Tomcat server has started up now.\n\n";
+	} else {
+	    $server_status = "failed-to-start"; # no need to set this, will be exiting below anyway
+
+	    print STDERR "Error: failed to start greenstone tomcat server\n";
+	    print STDERR "$!\n";
+	    print STDERR "Command attempted was:\n";
+	    print STDERR "  $server_java_cmd\n";
+	    print STDERR "run from directory:\n";
+	    print STDERR "  $ENV{'GSDL3SRCHOME'}\n";
+	    print STDERR "----\n";
+	    
+	    exit -1;
+	}
+    }
+    else {
+	print STDERR "@@@@ failed to start tomcat\n\n";
+	$server_status = "failed-to-start"; # no need to set this, will be exiting below anyway
+
+	print STDERR "Error: unable to start greenstone tomcat server\n";
+	print STDERR "$!\n";
+	print STDERR "Command attempted was:\n";
+	print STDERR "  $server_java_cmd\n";
+	print STDERR "run from directory:\n";
+	print STDERR "  $ENV{'GSDL3SRCHOME'}\n";
+	print STDERR "----\n";
+
+	exit -1;
+    }
+
+    if ($server_status eq "explicitly-started") {
+	$self->{'server_explicitly_started'} = 1;
+	print "Tomcat server ready and listening for connections at ";
+	print " $server_host:$server_port\n";
+	    
+	# now we know the server is ready to accept connections, fork a
+	# child process that continues to listen to the output and
+	# prints out any lines that are not INFO lines
+
+	if (fork()==0) {
+	    # child process
+
+	    my $line;
+	    while (defined ($line = <STARTIN>)) {
+
+		# if here, then some non-trival message has been logged
+		print "Tomcat/Solr processing: $line";
+	    }
+	    close(STARTIN);
+		
+	    # And now stop nicely
+	    exit 0;
+	}
+	# otherwise let the parent continue on
+    }
+    elsif ($server_status eq "already-running") {
+	print STDERR "Using existing tomcat server detected at $server_host:$server_port\n";
+	$self->{'server_explicitly_started'} = 0;
+    }
+    elsif ($server_status eq "failed-to-start") {
+	print STDERR "Started Solr/Tomcat web server at $server_host:$server_port";
+	print STDERR ", but encountered an initialization error\n";
+	exit -1;
+    }
+
+}
+
+sub explicitly_started
+{
+    my $self = shift @_;
+
+    return $self->{'server_explicitly_started'};
+}
+
+sub stop
+{    
+    my $self = shift @_;
+    my ($options) = @_;
+
+    my $solr_home         = $ENV{'GEXT_SOLR'};
+
+    chdir($ENV{'GSDL3SRCHOME'});
+
+    # defaults
+    my $do_wait = 1; 
+    my $output_verbosity = 1;
+
+    if (defined $options) {
+	if (defined $options->{'do_wait'}) {
+	    $do_wait = $options->{'do_wait'};
+	}
+	if (defined $options->{'output_verbosity'}) {
+	    $output_verbosity = $options->{'output_verbosity'};
+	}
+    }
+
+    my $server_java_cmd = "ant stop";
+
+    print STDERR "**** java server stop cmd:\n  $server_java_cmd\n" if ($output_verbosity>1);
+
+    if (open(STOPIN,"$server_java_cmd 2>&1 |")) {
+
+	my $line;
+	while (defined($line=<STOPIN>)) {
+	    print "@@@@ Tomcat shutdown: $line"; #if ($output_verbosity>1);
+	}
+	close(STOPIN);
+
+	if ($do_wait) {
+	    wait(); # let the child process finish
+	}
+
+	if ($output_verbosity>0) {
+	    print "@@@@@ Tomcat server shutdown\n";
+	}
+    }
+    else {
+	print STDERR "Error: failed to stop tomcat-server\n";
+	print STDERR "$!\n";
+	print STDERR "Command attempted was:\n";
+	print STDERR "  $server_java_cmd\n";
+	print STDERR "run from directory:\n";
+	print STDERR "  $solr_home\n";
+	print STDERR "----\n";
+
+	exit -2;
+    }
+}
+
+
+
+1;
Index: /gs3-extensions/solr/trunk/src/perllib/solrutil.pm
===================================================================
--- /gs3-extensions/solr/trunk/src/perllib/solrutil.pm	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/perllib/solrutil.pm	(revision 29711)
@@ -72,8 +72,9 @@
     my $full_post_jar   = solrutil::locate_file($search_path,$post_jar);
     
-    my $jetty_port = $ENV{'SOLR_JETTY_PORT'};
+    my $server_port = $ENV{'SOLR_PORT'}; # tomcat
+    my $server_host = $ENV{'SOLR_HOST'};
     
     # Now run solr-post command
-    my $post_props = "-Durl=http://localhost:$jetty_port/solr/$core/update";
+    my $post_props = "-Durl=http://$server_host:$server_port/solr/$core/update";
     $post_props .= " -Ddata=stdin";
     $post_props .= " -Dcommit=yes";
Index: /gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in
===================================================================
--- /gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in	(revision 29711)
+++ /gs3-extensions/solr/trunk/src/solr-tomcat-context.xml.in	(revision 29711)
@@ -0,0 +1,6 @@
+<Context docBase="@tomcathome@/webapps/solr.war" 
+	 debug="0" 
+	 crossContext="true" 
+	 privileged="true">
+  <Environment name="solr/home" type="java.lang.String" value="@gsdl3home@/ext/solr" override="true" />
+</Context>
Index: /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java
===================================================================
--- /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java	(revision 29711)
@@ -20,19 +20,17 @@
 
 // Greenstone classes
-import java.io.File;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
+import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.client.solrj.response.FacetField;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.SolrCore;
 import org.greenstone.LuceneWrapper4.SharedSoleneQueryResult;
 import org.greenstone.gsdl3.util.FacetWrapper;
@@ -50,4 +48,5 @@
 {
 
+  public static final String SOLR_SERVLET_SUFFIX = "/solr";
   protected static final String SORT_ORDER_PARAM = "sortOrder";
   protected static final String SORT_ORDER_DESCENDING = "1";
@@ -56,7 +55,6 @@
 	static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.GS2SolrSearch.class.getName());
 
-	static protected CoreContainer all_solr_cores = null;
-
-	protected HashMap solr_core_cache;
+        protected String solr_servlet_base_url;
+	protected HashMap<String, SolrServer> solr_core_cache;
 	protected SolrQueryWrapper solr_src = null;
 
@@ -72,25 +70,22 @@
 		// based on 'level' parameter passed in to 'setUpQueryer()'
 
-		solr_core_cache = new HashMap();
-
-		if (all_solr_cores == null)
-		{
-			// Share one CoreContainer across all sites/collections
-			try
-			{
-				String gsdl3_writablehome = GlobalProperties.getGSDL3WritableHome();
-				String solr_ext_name = GlobalProperties.getProperty("gsdlext.solr.dirname", "solr");
-
-				String solr_home_str = GSFile.extHome(gsdl3_writablehome, solr_ext_name);
-
-				all_solr_cores = new CoreContainer(solr_home_str);
-			}
-			catch (Exception e)
-			{
-				e.printStackTrace();
-			}
-		}
-
-		this.solr_src = new SolrQueryWrapper();
+		solr_core_cache = new HashMap<String, SolrServer>();
+
+		this.solr_src = new SolrQueryWrapper();		
+
+		// Create the solr servlet url on GS3's tomcat. By default it's "http://localhost:8383/solr"
+		// Don't do this in configure(), since the tomcat url will remain unchanged while tomcat is running
+		try {
+		    Properties globalProperties = new Properties();
+		    globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties"));
+		    String host = globalProperties.getProperty("tomcat.server", "localhost");
+		    String port = globalProperties.getProperty("tomcat.port", "8383");
+		    String protocol = globalProperties.getProperty("tomcat.protocol", "http");
+		    
+		    String portStr = port.equals("80") ? "" : ":"+port;
+		    solr_servlet_base_url = protocol+"://"+host+portStr+SOLR_SERVLET_SUFFIX;
+		} catch(Exception e) {
+		    logger.error("Error reading greenstone's tomcat solr server properties from global.properties", e);
+		}
 	}
 
@@ -100,33 +95,12 @@
 		boolean success = super.configure(info, extra_info);
 
-		// 1. Make the CoreContainer reload solr.xml
-		// This is particularly needed for when activate.pl is executed during
-		// a running GS3 server. At that point, the solr collection is reactivated and 
-		// we need to tell Greenstone that the solr index has changed. This requires
-		// the CoreContainer to reload the solr.xml file, and it all works again.
-
-		solr_core_cache.clear(); // clear the map of solr cores for this collection added to the map upon querying
-	    
-		// Reload the updated solr.xml into the CoreContainer
-		// (Doing an all_solr_cores.shutdown() first doesn't seem to be required)
-		try { 	
-		    String solr_home_str = all_solr_cores.getSolrHome();
-		    File solr_home = new File(solr_home_str);
-		    File solr_xml = new File( solr_home,"solr.xml" );
-		    
-		    //all_solr_cores.load(solr_home_str,solr_xml);
-		    all_solr_cores.load();
-
-		} catch (Exception e) {
-		    logger.error("Exception in GS2SolrSearch.configure(): " + e.getMessage());
-		    e.printStackTrace();
-		    return false;
-		}
-		
+		// clear the map of solr cores for this collection added to the map upon querying
+		solr_core_cache.clear(); 
+
 		if(!success) {
 		    return false;
 		}
 		
-		// 2. Setting up facets
+		// Setting up facets
 		// TODO - get these from build config, in case some haven't built
 		Element searchElem = (Element) GSXML.getChildByTagName(extra_info, GSXML.SEARCH_ELEM);
@@ -170,19 +144,6 @@
 		this.solr_src.cleanUp();
 
-
-		// 1. clear the map keeping track of the solrcores' EmbeddedSolrServers in this collection
+		// clear the map keeping track of the SolrServers in this collection
 		solr_core_cache.clear();
-
-		// 2. For solr 4.7.2., GLI (and ant stop from cmd) is unable to shutdown the tomcat server fully, 
-		// IF any collection has been previewed AND if there are any solr collections in the collect folder.
-		// This is because although the GS3 server seems to have stopped running at this stage, running a
-		// `ps aux | grep tomcat` reveals that some part of tomcat is still running. It seems to be still 
-		// holding on to the cores. Doing an all_cores.shutdown() here, stops GS3 from hanging on to the cores
-		// while still preserving the core desciptions in web/ext/solr.xml as needed when restarting the GS3 server.
-
-		// Need GS3 server (tomcat) to release the cores, else a part of tomcat is still running in the background 
-		// on ant stop, holding a lock on the cores. Doing shutdown() preserves core descriptions in solr.xml
-		all_solr_cores.shutdown();
-		all_solr_cores = null;
 	}
 
@@ -356,16 +317,15 @@
 		// solr-core, (caching the result in 'solr_core_cache')
 		String core_name = getCollectionCoreNamePrefix() + "-" + index;
-
-		EmbeddedSolrServer solr_core = null;
+		
+		SolrServer solr_core = null;
 
 		if (!solr_core_cache.containsKey(core_name))
-		{
-			solr_core = new EmbeddedSolrServer(all_solr_cores, core_name);
-
-			solr_core_cache.put(core_name, solr_core);
+		{		    
+		    solr_core = new HttpSolrServer(this.solr_servlet_base_url+"/"+core_name);
+		    solr_core_cache.put(core_name, solr_core);		    
 		}
 		else
 		{
-			solr_core = (EmbeddedSolrServer) solr_core_cache.get(core_name);
+		    solr_core = solr_core_cache.get(core_name);
 		}
 
@@ -381,5 +341,4 @@
 		try
 		{
-			//SharedSoleneQueryResult sqr = this.solr_src.runQuery(query);
 			SharedSoleneQueryResult sqr = this.solr_src.runQuery(query);
 
Index: /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java
===================================================================
--- /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java	(revision 29711)
@@ -13,55 +13,45 @@
 import org.w3c.dom.NodeList; 
 
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Properties;
 
-
+import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.servlet.SolrRequestParsers;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.SolrCore;
-
-import java.io.File;
-import java.util.Collection;
-
-
-import org.apache.log4j.*;
 
 
 public class SolrSearch extends LuceneSearch {
 
+    public static final String SOLR_SERVLET_SUFFIX = "/solr";
     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.SolrSearch.class.getName());
 
-    static protected CoreContainer solr_cores = null;
-    protected HashMap solr_server;
+    protected String solr_servlet_base_url;
+    protected HashMap<String, SolrServer> solr_server;
 
     public SolrSearch()
     {
-	solr_server = new HashMap();
+	solr_server = new HashMap<String, SolrServer>();	
 
-	if (solr_cores == null) {
-	    // Share one CoreContainer across all sites/collections
-	    try { 
-		
-		String gsdl3_home = GlobalProperties.getGSDL3Home();
-		String solr_ext_name = GlobalProperties.getProperty("gsdlext.solr.dirname","solr");
-		
-		String solr_home_str = GSFile.extHome(gsdl3_home,solr_ext_name);
-
-		solr_cores = new CoreContainer(solr_home_str);
-	    }
-	    catch (Exception e) {
-		e.printStackTrace();
-	    }
+	// Create the solr servlet url on GS3's tomcat. By default it's "http://localhost:8383/solr"
+	// Don't do this in configure(), since the tomcat url will remain unchanged while tomcat is running
+	try {
+	    Properties globalProperties = new Properties();
+	    globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties"));
+	    String host = globalProperties.getProperty("tomcat.server", "localhost");
+	    String port = globalProperties.getProperty("tomcat.port", "8383");
+	    String protocol = globalProperties.getProperty("tomcat.protocol", "http");
+	    
+	    String portStr = port.equals("80") ? "" : ":"+port;
+	    solr_servlet_base_url = protocol+"://"+host+portStr+SOLR_SERVLET_SUFFIX;
+	} catch(Exception e) {
+	    logger.error("Error reading greenstone's tomcat solr server properties from global.properties", e);
 	}
     }
@@ -76,11 +66,6 @@
 	super.cleanUp();
 	
-		// 1. clear the map keeping track of the solrcores' EmbeddedSolrServers in this collection
-		solr_server.clear();
-
-		// 2. Need GS3 server (tomcat) to release the cores, else a part of tomcat is still running in the background 
-		// on ant stop, holding a lock on the cores. Doing shutdown() preserves core descriptions in solr.xml
-		solr_cores.shutdown();
-		solr_cores = null;
+	// clear the map keeping track of the SolrServers in this collection
+	solr_server.clear();
     }
 
@@ -88,28 +73,12 @@
 	// adjusted configure to bring it up to speed with changes in GS2SolrSearch (for activate.pl) - not yet tested
     public boolean configure(Element info, Element extra_info) {
-		boolean success = super.configure(info, extra_info);
+	boolean success = super.configure(info, extra_info);
 	
-		// 1. Make the CoreContainer reload solr.xml
-		// This is particularly needed for when activate.pl is executed during
-		// a running GS3 server. At that point, the solr collection is reactivated and 
-		// we need to tell Greenstone that the solr index has changed. This requires
-		// the CoreContainer to reload the solr.xml file, and it all works again.
-
-		solr_server.clear(); // clear the map of solr cores for this collection added to the map upon querying
-	    
-		// Reload the updated solr.xml into the CoreContainer
-		// (Doing a solr_cores.shutdown() first doesn't seem to be required)
-		try { 	
-		    String solr_home_str = solr_cores.getSolrHome();
-		    File solr_home = new File(solr_home_str);
-		    File solr_xml = new File( solr_home,"solr.xml" );
-		    
-		    //solr_cores.load(solr_home_str,solr_xml);
-		    solr_cores.load();
-		} catch (Exception e) {
-		    logger.error("Exception in SolrSearch.configure(): " + e.getMessage());
-		    e.printStackTrace();
-		    return false;
-		}
+	// clear the map of solr cores for this collection added to the map upon querying
+	solr_server.clear();
+	
+	if(!success) {
+	    return false;
+	}
 
 	// initialize required number of SolrCores based on values
@@ -123,9 +92,8 @@
 	    String core_name = core_name_prefix + "-" + idx_name;
 
-	    EmbeddedSolrServer solr_core
-		= new EmbeddedSolrServer(solr_cores,core_name);	
-
+	    SolrServer solr_core = new HttpSolrServer(this.solr_servlet_base_url+"/"+core_name);
 	    solr_server.put(core_name,solr_core);
 	}
+	
 
 	return success;
@@ -165,14 +133,19 @@
 
         try {
+	    
+	    // Use SolrQuery with HttpSolrServer instead of ModifiableSolrParams, 
+	    // see http://stackoverflow.com/questions/13944567/querying-solr-server-using-solrj	    
+	    SolrQuery solrParams = new SolrQuery(query_string); // initialised with q url-parameter
+	    //solrparams.setRequestHandler("/select"); // default. Or try "select"
 
-	    ModifiableSolrParams solrParams = new ModifiableSolrParams();
-	    solrParams.set("q", query_string);
-	    //solrParams.set("start", start);
-	    //solrParams.set("rows", nbDocuments);
+	    ///solrParams.set("start", start);
+	    ///solrParams.set("rows", nbDocuments);
+
 
 	    String core_name = getCollectionCoreNamePrefix() + "-" + index;
 
-	    EmbeddedSolrServer solr_core = (EmbeddedSolrServer)solr_server.get(core_name);
-
+	    // http://stackoverflow.com/questions/17026530/accessing-a-cores-default-handler-through-solrj-using-setquerytype
+	    // default request handler is /select, see http://wiki.apache.org/solr/CoreQueryParameters
+	    SolrServer solr_core = solr_server.get(core_name);
 	    QueryResponse solrResponse = solr_core.query(solrParams);
 
Index: /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java
===================================================================
--- /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java	(revision 29710)
+++ /gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/util/SolrQueryWrapper.java	(revision 29711)
@@ -241,6 +241,6 @@
 	    }
 	} else {
-	    System.err.println("#### Not an EmbeddedSolrServer. This shouldn't happen." + solr_core.getClass());
-	    logger.error("#### Not an EmbeddedSolrServer. This shouldn't happen."  + solr_core.getClass());
+	    System.err.println("#### Not an EmbeddedSolrServer. SolrQueryWrapper.getTerms() not yet implemented for " + solr_core.getClass());
+	    logger.error("#### Not an EmbeddedSolrServer. SolrQueryWrapper.getTerms() not yet implemented for "  + solr_core.getClass());
 	}
     
Index: /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 29710)
+++ /main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 29711)
@@ -1083,7 +1083,7 @@
 	    // Do not do configGS3Server for a GS3 solr collection. Not at present at least, when we're stopping
 	    // and starting the GS3 server from GLI for solr cols, since this function clears the solr.xml file.
-	    if(Gatherer.c_man.isSolrCollection()) {
+	    /*if(Gatherer.c_man.isSolrCollection()) {
 		return;
-	    }
+		}*/
 
 		if (Configuration.library_url == null){
Index: /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 29710)
+++ /main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java	(revision 29711)
@@ -1753,6 +1753,6 @@
 		// For now, for a GS3 solr collection, we'd have stopped the GS3 server before building
 		// and will now need to restart it.
-		GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
-		thread.start();
+		/*GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
+		  thread.start();*/
 		
 		// Give the GS3 server time to restart:
Index: /main/trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 29710)
+++ /main/trunk/gli/src/org/greenstone/gatherer/gui/CreatePane.java	(revision 29711)
@@ -700,6 +700,6 @@
 	// and restart it after building is complete. Restart is done in CollectionManager.processComplete()
 	if(CollectionManager.isSolrCollection()) {
-	    GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "stop");
-	    thread.start();
+	    /*GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "stop");
+	      thread.start();*/
 	}
 
@@ -876,6 +876,6 @@
 	// then we also restart the GS3 server
 	if(CollectionManager.isSolrCollection()) {
-	    GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
-	    thread.start();
+	    /*GS3ServerThread thread = new GS3ServerThread(Configuration.gsdl3_src_path, "restart");
+	      thread.start();*/
 	}
 
Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 29710)
+++ /main/trunk/greenstone3/build.xml	(revision 29711)
@@ -2034,6 +2034,13 @@
     <if>
       <bool><istrue value="${tomcat.islocal}"/></bool>
-      <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
-      <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
+      <if><bool><available file="${catalina.home}/lib/xercesImpl.jar"/></bool><!-- moved for solr -->
+	<copy file="${catalina.home}/lib/xercesImpl.jar" todir="${web.applet}"/>
+	<copy file="${catalina.home}/lib/xml-apis.jar" todir="${web.applet}"/>
+	
+	<else><!-- get from default GS3 web lib location-->
+	  <copy file="${web.lib}/xercesImpl.jar" todir="${web.applet}"/>
+	  <copy file="${web.lib}/xml-apis.jar" todir="${web.applet}"/>
+	</else>
+      </if>
     </if>
 
