Updating existing CollectionSpace systems to use Java 7

Oracle Corporation recommends that users migrate to Java 7 (JDK 7) "in order to continue receiving public updates and security enhancements." The company will not be issuing any more updates - including security updates - for Java 6.

While CollectionSpace versions 3.2.1 and above already use Java 7, earlier versions of CollectionSpace still use Java 6.

A summary of CollectionSpace's support for Java 7 and Java 6:

CollectionSpace version

Uses by default

Capable of using

3.2.1 and later

Java 7

 

3.2 and earlier

Java 6
Java 7 (after updating per below)

If your CollectionSpace system is running version 3.2 or earlier, and you wish to update it to use Java 7, here's how to do so:

While these instructions are believed to be correct, they have not yet been tested.

Verify that your CollectionSpace server host is running Java 7

Verify that Java 7 is running on your CollectionSpace server host, and specifically, that the key java and javac commands are from your installation of Java 7.

To verify this, in Linux or Mac OS X, for instance, enter the following at a command prompt:

java -version

The output from entering this command should include a version string beginning with 1.7; e.g.

java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

Similarly, enter:

javac -version

The output from entering this command should include a version string beginning with 1.7; e.g.

javac 1.7.0_15

If you do not see output similar to that above, refer to the section on installing Java within the relevant installation guide for your system.

Apple officially supports the installation of Java 7 only on OS X 10.7 and above.

Backup your existing CollectionSpace server folder

Make a backup of your existing CollectionSpace server folder, if you don't have one already.

The path to that folder typically can be found in the value of the CSPACE_JEESERVER_HOME environment variable; e.g. by entering the following at a command prompt in Linux or Mac OS X:

echo $CSPACE_JEESERVER_HOME

An example of making a backup copy of that folder, on a Linux, Mac OS X or other Unix-like operating system, substituting the actual path to that folder - obtained via the 'echo' command above - for the placeholder {server_folder_name}, where it appears in the command below:

cp -R {server_folder_path} {server_folder_path}-backup

Update the CollectionSpace Services layer

Update and rebuild the CollectionSpace Services layer under Java 7 and deploy (copy) it to your server. To do so:

  1. Check out a copy of the CollectionSpace Services layer source code.
    • If you've configured or customized the Services layer configuration or code (highly likely):
      • If you maintain it in a version control system (e.g. Git or Subversion), check it out from there.
      • If you don't maintain it in a version control system, make a copy of the directory containing your Services layer code and configuration and edit this copy.
    • If your CollectionSpace system hasn't been configured or customized, you can check out an unmodified copy of the Services layer for your specific version of CollectionSpace, via the instructions in How to check out the Services layer source code.
  2. Update version numbers in two build configuration files within this source code tree. Specifically:
    1. In the top-level pom.xml file, edit the version of Java targeted by the maven-compiler-plugin, changing the <source> and <target> values to 1.7, from their current value of 1.6; e.g.

      ...
      <build>
        <pluginManagement>
          <plugins>
            ...
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              ...
              <configuration>
                <source>1.7</source>
                <target>1.7</target>
      

      (See this code commit for an example of this change.)

    2. In the services/id/service/pom.xml file, edit the version of the xstream dependency, changing it to 1.4.2 from 1.3.1:

      ...
      <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.4.2</version>
      

      (See this code commit for an example of this change.)

  3. Build and deploy (copy) the updated Services layer to your server. From the top of the Services layer source code tree, enter:

    mvn clean install -DskipTests=true
    

    Then:

    ant undeploy deploy
    

Update the CollectionSpace Application layer

Update and rebuild the CollectionSpace Application layer under Java 7, and deploy (copy) it to your server. To do so:

  1. Check out a copy of the CollectionSpace Application layer source code.
    • If you've configured or customized the Application layer configuration or code (highly likely):
      • If you maintain it in a version control system (e.g. Git or Subversion), check it out from there.
      • If you don't maintain it in a version control system, make a copy of the directory containing your Application layer code and configuration and edit this copy.
    • If your CollectionSpace system hasn't been configured or customized, you can check out an unmodified copy of the Application layer for your specific version of CollectionSpace, via the instructions in How to check out the Application layer source code.
  2. Update version numbers in twelve (12) build configuration files within this source code tree. Specifically:
    1. In each of twelve pom.xml files found in various places throughout the Application layer source code tree, edit the version of Java targeted by the maven-compiler-plugin, changing the <source> and <target> values to 1.7, from their current values of either 1.6 or 1.5; e.g.

      ...
      <build>
        <pluginManagement>
          <plugins>
            ...
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              ...
              <configuration>
                <source>1.7</source>
                <target>1.7</target>
      

      This is the list of files to which you'll need to make this identical change:
      csp-api/pom.xml
      csp-helper/pom.xml
      csp-impl/pom.xml
      cspi-file/pom.xml
      cspi-installation/pom.xml
      cspi-schema/pom.xml
      cspi-services/pom.xml
      cspi-webui/pom.xml
      general-utils/pom.xml
      jxutils/pom.xml
      tomcat-main/pom.xml
      war-entry/pom.xml
      (See this code commit for examples of these changes.)

  3. Build and deploy (copy) the updated Application layer to your server. From the top of the Application layer source code tree, enter:

    mvn clean install -DskipTests=true
    

Remove incompatible files from the server folder

Delete any copies of an older, Java 7-incompatible JAR file named xstream-1.3.1.jar that may still be present in your server folder. To do so:

  1. Look for copies of the older, incompatible xstream-1.3.1.jar file to delete in each of the following two (2) locations:
    • $CSPACE_JEESERVER_HOME/lib
    • $CSPACE_JEESERVER_HOME/webapps/cspace-services/WEB-INF/lib
  2. Delete any such files you may find

(Newer versions of this file named xstream-1.4.2.jar are compatible with Java 7.)

Restart your server and verify normal operation

  1. Shut down your server
  2. Start up your server and verify normal operation