This will describe how to get the apollo demo site and the MysqlAdmin web application working using Jetty under Win32 and Unix platforms. Jetty is a speedy servlet environment, which integrates the webserver with the servlet engine. Jetty is also very easy to configure, and is probably a good choice for an environment for somebody who just wants to poke around.
You must download the following files before starting the installation process:
http://sourceforge.net/project/showfiles.php?group_id=7322 or http://jetty.mortbay.com/
MySQL for win32:
Sun JDK1.2.2 or Sun JDK 1.3 for win32 or any JVM >=1.2 for Unix:
Download the MM.MySQL JDBC Driver jar file:
Download the DBConnectionBroker jar file:
Install the JDK into any directory, the JDK installer should take care of everything for you
If your under unix, I always compile my own MySQL server from source code. Mysql's directory structure by default is, IMHO, rather stupid. I would suggest running the configure script like this:
That will put all of the MySQL stuff in the same directory, and not mix it in with your other files in var and lib.
Install MySQL into c:\mysql (this is the default) using the binary distribution for win32. If you choose another directory, just keep in mind some of the sample paths I give you need to be adjusted.
Untar the jetty package and place the root of it in c:\Jetty if you're under win32, or under /usr/local/jetty if your using a unix. If you choose another directory, just keep in mind some of the sample paths I give you need to be adjusted.
Install Apollo Demo Site:
Copy in the apollo-demo.jar file and place it in c:\Jetty\lib or /usr/local/jetty/lib (depending on your OS).
Install other Jar Files:
Also place the MM.MySQL JDBC driver and the DBBroker.jar files in the lib directory aswell.
Under win32 MySQL by default will mangle the case of table names. You need to turn this feature off, otherwise Storable will not function properly. In your c:\my.cnf add this clause in the [mysqld] section:
set-variable = lower_case_table_names=0
If you do not have a c:\my.cnf file, you can copy the default one from c:\mysql\my-example.cnf
Start the MySQL server by running c:\mysql\bin\mysqld
Connect to the MySQL server by running c:\mysql\bin\mysql or /usr/local/mysql/bin/mysql
Create the apollodemo database by issuing the SQL Command:
create database apollodemo;
Add the correct MySQL permissions to the apollodemo user by issuing the SQL command:
grant ALTER, CREATE, DELETE, DROP, INDEX, INSERT, SELECT, UPDATE on apollodemo.* to apollodemo@localhost identified by 'apollo64demo';
If you will be running the apollodemo on a server other then the machine running MySQL, you will need to issue the command above a second time, this time replacing "localhost" with the hostname of the machine you would be connecting from.
Quit MySQL by issuing the "quit;" command.
Jetty needs to be configured to attach a particular URL to apollodemo and MysqlAdmin. Modify the c:\Jetty\etc\demo.xml or /usr/local/Jetty/etc/demo.xml file. Add the following lines to the demo.xml file. The bold lines are the new lines, italics are the existing lines.
Configure ApolloDemo or MysqlAdmin
If you are running these apps exactly as I describe above, then you may skip this step.
Each apollo application has quite a bit of configurability. This is controlled through a properties file for each servlet. The apollo-demo.jar file includes properties files for the apollo-demo site and the MysqlAdmin application. These properties files are configured so they should work out of the box if you configure your machine as described above. The properties file is located in the same package as the initiating servlet class, with the the filename the full class name of that initiating servlet, with a .properties extension. So if you extract the JAR archive, the properties file for the apollo-demo site will be org/projectapollo/demo/org.projectapollo.demo.Demo.properties.
The properties file configures stuff like what database adapter to use, what database login/password/hostname to use, default session timeout, SMTP server for email transmission, and various other settings.
If you need to change the stock properties file, you can either change it and rejar the package, or unjar the package and add the base directory to your classpath (and remove the JAR from your classpath). If you plan on checking out the sourcecode or doing any code changes to the apollodemo site, you'll need to unarchive it anyway.
Before the demo site will run, you will need to start up all the applications first.
Start the MySQL server if you have not already, by running c:\mysql\bin\mysqld
from the /usr/local/jetty directory (and NO other directory), run:
You will need to set the JAVA_HOME and the JETTY_HOME environment variables:
You will need to add apollo-demo.jar, the MM MySQL JDBC driver, and the DBBroker jar files to the classpath. This is done by doing something like:
If you are running Windows 95, 98 or Me, the batch file used to start Jetty will not function (atleast it doesn't work right now!). Download this file, and save it as Jetty2.bat in the c:\Jetty\bin directory. Use this batch file instead of Jetty.bat for starting Jetty.
From the c:\Jetty directory, (and NO other directory), run:
You should now be able to access the demo site by requesting the url: http://localhost:8080/demo/demo and access the MysqlAdmin site by requesting the url: http://localhost:8080/demo/MysqlAdmin