Setting up a Development Environment for Project.net on Tomcat

Overview

A Project.net development and build environment can be created on any operating system platform that supports Java, the Tomcat5.5 application server, the ant utility, and a Subversion client. Follow the steps below to configure a developer workstation to build and run the Project.net application on the Tomcat5.5 application server.

1. Download the needed 3rd-party software

Tomcat 5.5
Download: http://tomcat.apache.org/download-55.cgi
How to Install: http://tomcat.apache.org/tomcat-5.5-doc/setup.html

JDK 1.5
Download: http://java.sun.com/javase/downloads/index_jdk5.jsp
How to Install: http://java.sun.com/j2se/1.5.0/install.html

ANT 1.6.5
Download: http://ant.apache.org
How to Install: http://ant.apache.org/manual/index.html

Subversion (svn) client v1.2.3
Download: http://subversion.tigris.org
How to Install: http://svnbook.red-bean.com/

Oracle Database 10g (10.2) (Express, Standard or Enterprise)
http://www.oracle.com/technology/software/products/database/oracle10g/index.html

2. Checkout the Project.net Source Code from the Subversion Repository

Refer to this page for directions on downloading a copy of the the Project.net source tree.

3. Install and Setup the Oracle Database

  • Install Oracle 10.2 Enterprise Edition
  • Run the Oracle "Database Configuration Assistant" to create a database instance for the Project.net Application. Create an Oracle database instance (called v83dev or any name you want). Set and remember the SYSTEM password.
  • Run the Project.net database schema creation script
    1. Go to the database script directory in the source code tree: core\db\oracle\createscripts\admin.
    2. Edit the pnetMasterDBBuild.bat (or pnetMasterDBBuild.sh) file. Set the environment variables in this script to match your database configuration. Further instructions are available in the script file.
    3. To start the database installation, run the batch command pnetMasterDBBuild.bat (or pnetMasterDBBuild.sh) from within the core\db\oracle\create-scripts\admin directory.
    4. Check the logs in the log file location you have specified inside of the pnetMasterDBBuild file. You will notice some errors in the logs about public synonym already exists, etc., but there should be only about 55 lines in the log file with the word "ERROR".
    5. If the script fails and you need to re-run it, it's best to run the core/db/oracle/create-scripts/tools/drop_pnet_and_user_schemas.sql script to clean everything up before trying again.

4. Install and setup Tomcat application server

Windows Installation:

  • Run the installer apache-tomcat-5.5.23.exe (Windows service installer)
  • Select the path that you want to install tomcat5.5 (C:\Tomcat 5.5) and click Next.
  • Next Screen (Configuration Options)
  • HTTP/1.1 Connector Port : 8080
  • User Name : manager
  • Password : manager
  • select the path of J2SE 5.0 JRE installed on your system (C:\Program Files\Java\jre1.5.0_06)
  • Click the Install button. (While installing Tomcat 5.5 it may ask the network password, click cancel)
  • On the last screen uncheck the option for Run Apache Tomcat and click Finish.

Linux Installation:

  • If you have already downloaded the binary, simply copy it to the directory you want to install it under and expand the file. For example, if I downloaded the Tomcat tar file into /home/someuser/downloads and wanted to install it under /opt, here is what I would do. As root user:
# cp /home/someuser/downloads/jakarta-tomcat-5.x.xx.tar.gz /opt
# tar -zxvf jakarta-tomcat-5.x.xx.tar.gz
  • A directory called jakarta-tomcat-5.5.xx will be created and the Tomcat files will expanded under it. You may want to create a symbolic link to a the /opt/tomcat directory for easier upgrades and configuration.
# ln -s jakarta-tomcat-5.5.25 tomcat
  • In order for Tomcat to startup and shutdown, you will also need to add an environment variable pointing to the Tomcat directory (CATALINA_HOME), and one variable pointing to your Java SDK directory (JAVA_HOME). Insert the following lines inside /etc/profile or /root/.bashrc.
export JAVA_HOME=/opt/jdk151
export CATALINA_HOME=/opt/tomcat

please make sure that you enter your operating system installation paths

  • To Start Tomcat
# $CATALINA_HOME/bin/startup.sh

If Tomcat does not start and you downloaded the zip file, the cause is probably due to permissions. Ensure that the following files are executable : inside $CATALINA_HOME/bin directory,

# chmod +x startup.sh
# chmod +x shutdown.sh
# chmod +x tomcat.sh

* To Stop Tomcat

# $CATALINA_HOME/bin/shutdown.sh

5. Configure Tomcat application server

  1. Activate Tomcat Manager -- Edit the CATALINA_HOME/conf/tomcat-users.xml file to create a tomcat user with the "manager" role. A sample "tomcat-users.xml" file with a new user named "manager" with the "manager" role associated with it:
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
       <role rolename="tomcat"/>
       <role rolename="role1"/>
       <role rolename="manager"/>
       <user username="tomcat" password="tomcat" roles="tomcat"/>
       <user username="both" password="tomcat" roles="tomcat,role1"/>
       <user username="role1" password="tomcat" roles="role1"/>
       <user username="manager" password="manager" roles="manager"/>
    </tomcat-users>
    
  2. Delete CATALINA_HOME/webapps/ROOT folder (because the pnet application will be associated with this default "/" URL and will be installed in this folder).
  3. copy svn-root/trunk/core/lib/jdbc/ojdbc14.jar, svn-root/trunk/core/lib/mail.jar, and svn-root/trunk/core/lib/activation.jar to CATALINA_HOME/common/lib. Placing these jars in both common/lib and a web application's lib folder will cause an error, so ensure you have them in the $CATALINA_HOME/common/lib location only.
  4. create the CATALINA_HOME/common/endorsed folder and copy here serializer.jar, xalan.jar, xercesImpl.jar and xml-apis.jar from svn-root/trunk/core/lib/endorsed/

6. How to configure Project.net to run on Tomcat

  1. CATALINA_HOME/server/lib/catalina-ant.jar must be included in the lib folder of the ANT tool used for building the project. If building from eclipse, the catalina-ant.jar can be added on the Window-->Preferences-->Ant-->Runtime dialog box. Or copy CATALINA_HOME/server/lib/catalina-ant.jar to ANT_HOME/lib folder.
  2. Rename svn-root/trunk/core/build-tomcat.properties.example to svn-root/trunk/core/build-tomcat.properties
  3. Edit svn-root/trunk/core/build-tomcat.properties. Edit the catalina.home property to point to your Tomcat installation directory. Also edit tomcat.url, tomcat.username, tomcat.password for the Tomcat Manager
    catalina.home=c://Tomcat 5.5
    
    tomcat.url=http://localhost:8080//manager
    tomcat.username=manager
    tomcat.password=manager
    
    tomcat.path=/
    
  4. Edit svn-root/trunk/core/web/META-INF/tomcat/context.xml to configure the jndi resources for url, username, password for the jdbc/PnetDB database connection pool and mail.smtp.host for mail/PnetSession.
    <Context debug="5" reloadable="true" crossContext="true">
    	<Resource name="jdbc/PnetDB" auth="Container"
    		type="javax.sql.DataSource" username="pnet_user" password="pnet_user"
    		driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:v830"
    		maxActive="8" maxIdle="4"/>
    	<Resource name="mail/PnetSession" auth="Container"
    		type="javax.mail.Session"
    		mail.smtp.host="localhost"/>
    </Context>
    
  5. Edit svn-root/trunk/core/config/defaultsettings.properties to configure the port changes (if tomact is configured to run on a different port than 7001)
    siteHost=localhost:<new port number> 
    
  6. Edit svn-root/trunk/core/config/scheduler/quartz.properties to configure the jndiURL
    org.quartz.dataSource.PnetDB.jndiURL = java:comp/env/jdbc/PnetDB 
    

7. How to deploy Project.net on Tomcat

  1. Start Tomcat server
  2. Start database server
  3. For building application for Tomcat 5.5 You must use build-tomcat.xml file.
  4. Go to svn-root/trunk/core/ and run
    ant -buildfile=build-tomcat.xml deploy
    

Other targets

  1. deploy - to build and install the application on the Tomcat server
  2. undeploy - uninstall the application from the Tomcat server
  3. reload - to reload the application
  4. redeploy - rebuilds the application and reloads the running application
  5. redeploy-classes - compiles the .java sources, copy the modified ones and reloads the running application
  6. redeploy-jsp - copy only the modified jsp files into the running application

8. Configure the Project.net Application

  1. http://localhost:8080 Login as the application administrator.
    username: appadmin
    password: appadmin
    
  2. Change the file path for document storage on your computer.

Click "Application Space" on the lower left to view and change Project.net application configuration.

Click the "Manage --> Doc Vault" link

Enter a directory path for each of the three "Path to Repository Root" such as:

c:\pnet-doc-vault\one

c:\pnet-doc-vault\two

c:\pnet-doc-vault\three

  1. You may also need to change some of the application settings on the Application Space --> Sys. Settings page to match your server. For instanace, if you are running on linux, you will need to change the postDataTempDir setting since it default to a Windows C:\temp directory.
  1. If you want the URLs in the email notifications to match your machine, you will need to change three configuration tokens. Go to the Application Space --> Configurations --> Project.net configuration --> Tokens --> select Basic Branding --> click Filter
  1. Modify the following tokens used to construct the email notification URLs, probably with the following values:
    prm.global.brand.defaulthost            localhost
    prm.global.brand.defaultjsprooturl      /
    prm.global.brand.defaultsitescheme      http://
    

9. Install License Files

See Installing Licensing Files.pdf from the Downloads page for instructions on installing the license properties.