Development Environment

For the assignments in this course you will use a provided development environment. This environment consists of a preconfigured package including Apache Tomcat, which has been bundled with Apache Axis2, Apache Derby, Apache Ant, and an SSL keystore/truststore for using HTTPS. As these technologies are platform-independent, it should be possible to use this development environment on any platform that supports Java, this has only been tested on Linux, Mac OS/X (1.4 and later), and Windows (XP and later) however.

Installing the environment

Each student will receive a unique zip-file named after the students user account to download from the download directory. Download the zip-file and unpack it at a location of your choosing on the computer you wish to use for the assignments. When using the CS computers for the assignments, you are recommended to use the path ~/edu/5dv095/env/ for the development environment. If you are unable to find a zip-file with your username, contact one of the teachers as soon as possible - do NOT use someone elses package. Please note that the package also contains an alternative configuration file to resolve port conflicts when the package is used on the CS computers.

When unpacking the zip-file a directory structure containing a folder named 5dv095 is created. This is the root folder for your development environment and contains (among others) the following files:

5dv095/                                                     <- Your development environment root folder
       apache-ant-1.7.0/                                    <- Apache Ant (do not modify)
       apache-tomcat-6.0.16/                                <- Apache Tomcat
                            conf/                           <- Apache Tomcat configuration directory
                                 catalina.out               <- Apache Tomcat default log file
                            logs/                           <- Apache Tomcat log directory
                                 server.xml                 <- Apache Tomcat configuration file
                                 server.xml.cs              <-         - " -   (alternative port configuration)
                                 server.xml.home            <-         - " -   (default port configuration)
                            webapps/                        <- web application directory (place lecture example web applications here)
                                    axis2/                  <- Apache Axis2 home (web service engine web application)
                                          WEB-INF/
                                                  services  <- web service directory (place lecture example and assignment web services here)
       username/
                build.xml                                   <- web application Ant build file
                docs/                                       <- web application documentation directory
                lib/                                        <- web application Java library directory
                META-INF/                                   <- manifest and configuration files for archives
                src/                                        <- web application Java source code directory
                start-windows.bat                           <- start script for Windows environments
                start-mac.sh                                <-    -  "  -        MacOS X environments
                start-linux.sh                              <-    -  "  -        UNIX / Linux environments
                stop-windows.bat                            <- stop script for Windows environments
                stop-mac.sh                                 <-    -  "  -        MacOS X environments
                stop-linux.sh                               <-    -  "  -        UNIX / Linux environments
                update-windows.bat                          <- update script for Windows environments
                update-mac.sh                               <-    -  "  -        MacOS X environments
                update-linux.sh                             <-    -  "  -        UNIX / Linux environments
                web/                                        <- web application source directory (JSP files, etc)
                    dist/                                   <- generated by the update scripts
                         username.war                       <- web application archive
                    index.jsp                               <- your web application index page
                    WEB-INF/
                            lib                             <- web application library directory
where username is the students username.

Using the environment for web development

When starting Tomcat (by running the update script), a web application archive named username.war is created in the 5dv095/username/dist/ directory. This web application automatically gets deployed into Tomcat (which is restared by the update script) and you can access it through a web browser by surfing to the URL http://localhost:8080/username

Developing web pages:

  1. Edit the JSP pages in 5dv095/username/web
  2. Run the update script (the one selected for your operating system)
  3. Reload the web page in your browser
In addition to the update script, the start and stop scripts can also be used to control the web server. These two will not recompile and deploy the web application though.

Using the environment for web service development

The Apache Axis2 SOAP engine has in this package been bundled to run as a web application module in the Apache Tomcat Servlet engine. In other words, all web services deployed in the service engine will run as threads in the Web Server process. This will result in, e.g., that the stdout stream of services will be redirected to the Tomcat logs, and all services will use the Web Server port regardless of port specified in the service bindings of the WSDL file.

When developing a web service it is recommended that you create a service project in the root directory of your development environment. This to assure that your service build file will be able to locate the Axiom API libraries.

Developing web services:

  1. Create a service description WSDL file
  2. Generate service stub classes
  3. Implement the service implementation
  4. Implement a service client
  5. Deploy your service
  6. Restart the service engine (only required for updates)
  7. Test your service using your service client

Installing Java

A functional installation of Java (version 1.6 or later) is required to use the development environment. If installing Java on your Windows PC, use Suns Java JDK v1.10. This is (as of mid-November 2008) the latest stable release of Suns JDK. Keep the default install path for Java: C:\Program Files\Java\jdk1.6.0_10\ and use all other default values in the installation process as well.

Setting JAVA_HOME

The JAVA_HOME environment variable allows Tomcat to locate and determine which version of Java to use. The update scripts in the environment attempts to set JAVA_HOME to a predefined value:
UNIX/Linux
/pkg/java
Windows (all versions)
C:\Program Files\Java\jdk1.6.0_10
MacOS X (version 1.5 with Java 1.6 update)
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
For earlier versions of MacOS X (or MacOS X 1.5 without the Java 1.6 update), contact one of the teachers for details on how to custom build a package). If you have a different version of Java, or have installed Java in a custom location, you will have to update the JAVA_HOME portion in the update scripts.
The update scripts are regular text files, simply replace the path on the JAVA_HOME line with the path to your Java installation location using an editor of your choosing.

Using the environment on CS computers

If you use the environment on the CS computers you will not need to install or configure Java (as it is already installed). The Tomcat configuration file server.xml.cs has been preconfigured to contain unique port numbers for your user, if you choose to use the CS computers to do the assignments, we recommed you copy the server.xml.cs onto server.xml to avoid port conflicts.

Manually changing the Tomcat port

In addition to the tip with using a preconfigured configuration file above, you can alter the Tomcat configuration file and specify another port manually. Simply search and replace 8080 by the port number you wish to use in the Tomcat configuration file (apache-tomcat-6.0.16/conf/server.xml). If you wish to avoid a conflict for HTTPS we also recommend that you replace 8443 with another port number of your choosing. Note that you need to select a port numbers higher than 1023 on UNIX (and mac) systems (as they are reserved for the root user).

HELP!!!

Having problems installing or using the environment? Contact one of the teachers!