INSTRUCTIONS FOR DOWNLOADING AND INSTALLINGTHE SAMPLE APPLICATION |
For purposes of this document, we will assume that you are on a Windows platform and have already downloaded this package and extracted its contents under the C:\myprojects directory. If not, the link for downloading is found below.
We recommend JDK version 1.5 or version 1.6 for this application. Both versions are available on Sun's Web site.[ download JDK 1.5 ] [ download JDK 1.6 ]
We recommend using Ant 1.4.1 or better. Also, on systems running Windows, it is recommended that Ant should be installed into a directory with no spaces in its name. (e.g., C:\ant, not C:\program files\ant)[ download Ant ]
If you do not already have a J2EE Web container installed, we recommend Apache Tomcat. It is open source, freely available, and supports all the functionality required by the application. Either version 5.5 or version 6 is recommended.
Remember that Tomcat defaults to using port 8080, so either include the port number in your localhost URLs (e.g., http://localhost:8080) or change Tomcat's configuration to use port 80 for HTTP requests. (Read the Tomcat documentation for instructions on how to do this.)[ download Tomcat 5.5 ] [ download Tomcat 6 ]
If you do not already have a DBMS installed, we recommend MySQL. Like Apache Tomcat, it is open source, freely available, and supports the functionality required by the application. In fact, the application's data access services were written under the assumption that a simple DBMS like MySQL (which does not support triggers or stored procedures or automated referential integrity) would be used. Version 5.0 is recommended. The JDBC driver for MySQL is included in the download for the DBMS itself, but it is also accessible separately if desired.
The dbschema.sql and populate.sql query files in the above files may be imported into SQL processing tools associated with other DBMSs to create and populate the application tables if necessary. The mysqlgrant.sql query file performs SQL grant statements needed if you are using a newly installed MySQL installation, as shown below:C:\> cd \mysql\bin C:\mysql\bin> mysql -u root -p Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use test Database changed mysql> source \myprojects\vrlsapp\sql\dbschema.sql ... mysql> source \myprojects\vrlsapp\sql\populate.sql ... mysql> source \myprojects\vrlsapp\sql\mysqlgrant.sql ...
grant all on test.* to waabook identified by 'waabook' ; grant all on test.* to waabook@localhost identified by 'waabook' ;
- ANT_HOME - the directory in which Ant was installed
- e.g., c:\ant
- JAVA_HOME - the directory in which the JDK was installed
- e.g., c:\jdk
- TOMCAT_HOME - the directory in which Tomcat was installed (if you are using Tomcat)
- e.g., c:\program files\tomcat
C:\> cd directory-containing-driver-file C:\...\> copy mysql-connector-java-5.0.5-bin.jar %TOMCAT_HOME%\common\libIf you are using a DBMS other than MySQL, read the documentation for your DBMS to determine where you can find the appropriate drivers.
If you are using a Web container other than Tomcat, follow the instructions regarding where JDBC drivers used for JNDI-defined DataSources belong.
In older versions of Tomcat, the most direct way to define the DataSource was to edit the server.xml file found in the %TOMCAT_HOME%\conf directory, adding a DataSource definition to the Tomcat configuration manually.<Context path="/vrls"> <Resource name="jdbc/vrls" type="javax.sql.DataSource" password="waabook" driverClassName="com.mysql.jdbc.Driver" maxIdle="2" maxWait="5000" validationQuery="select * from vrls_xref_listing_type" username="waabook" url="jdbc:mysql://localhost:3306/test?autoReconnect=true&jdbcCompliantTruncation=false" maxActive="4" /> </Context>Tomcat 5.5 and 6.x let you place a context.xml file containing the above text in a WAR file's META-INF directory. This lets you deploy applications with their own customized resource definitions without having to modify the server's base configuration files. We include a context.xml in the application distribution and place it in the appropriate place in the WAR file as part of the build process. If you are using a different application server, a different DBMS, or different connection credentials, you will need to modify this file before the application is built and deployed.
This will cause Ant to look for the build.xml file found in that directory, and use the directives in that file to invoke the Java compiler (%JAVA_HOME%\bin\javac) in order to build the application binaries.C:\> cd myprojects\vrlsapp C:\myprojects\vrlsapp> %ANT_HOME%\bin\ant
C:\myprojects\vrlsapp> %ANT_HOME%\bin\ant war
We provide an Ant target in theC:\myprojects\vrlsapp> %TOMCAT_HOME%\bin\shutdown.bat
C:\myprojects\vrlsapp> rmdir %TOMCAT_HOME%\webapps\vrls /s /q
C:\myprojects\vrlsapp> copy vrls.war %TOMCAT_HOME%\webapps
C:\myprojects\vrlsapp> %TOMCAT_HOME%\bin\startup.bat
build.xml
file called "deploy", which should work if you are using Tomcat 5.5 and installed Tomcat 5.5 in the default location. If you have changed any of the defaults, you may need to edit the build.xml
file to reflect those changes. If you are unsure of how to do this, go through the list of manual steps described above.
C:\myprojects\vrlsapp> %ANT_HOME%\bin\ant deploy