Standalone WAR file deployment

Saxbi can be deployed as a typical WAR file. All you need to do is setup a database for Saxbi to use as its repository, map a connection to your servlet container, and deploy the WAR file. These instructions will show you how to deploy Saxbi to a MySQL database on Tomcat 7 running in a Ubuntu Linux distribution.

Create Database
The following instructions will be for creating a database and user for Saxbi with MySQL. You can use your own tool or even another type of database as long as you substitute the proper steps. MySQL code:

USE saxbi; DROP TABLE IF EXISTS ARTIFACT; CREATE TABLE ARTIFACT (  id VARCHAR (64) NOT NULL PRIMARY KEY,   name VARCHAR(255),   type VARCHAR(255) NOT NULL,   clazz VARCHAR(255) NOT NULL,   added TIMESTAMP DEFAULT NOW,   modified TIMESTAMP,   content TEXT NOT NULL,   description VARCHAR(255) ); INSERT INTO ARTIFACT VALUES (  'configuration',   'Configuration',   'Configuration',   'com.saxifrages.stellaris.application.StellarisConfiguration',   NOW,   NOW,   'saxbiadminsaxbipassword',   'Main configuration for Saxbi repository.' );

Configure Tomcat JNDI Data Source
The defaut Saxbi Server WAR file looks to a JNDI data source for its repository. This configuration allows you to put a data type of some kind in your servlet container and allow the WAR to reach out and grab it by reference. This means that the database configuration and driver is not a part of the WAR itself, making it more portable and allowing the deployer much more flexibility in deployment.

In the Tomcat conf/ directory, edit context.xml and add the following:



This will create a JNDI DataSource that the Saxbi Server servlet can reference by name "saxbi-server". You also need to add a driver to your Tomcat installation. Different versions of Tomcat use different folders for common JAR files, but in recent versions of Tomcat this is the Tomcat root folder/lib. Place mysql-connector-java-5.1.12-bin.jar (or whatever version you are using) in this folder. Restart Tomcat. This JAR file can be downloaded from the MySQL website. For convenience, a copy of a MySQL connector JAR is available from the Saxbi download site in the Supporting Files folder.

So, now we have a database setup (somewhere), we have our servlet container setup and containing a reference to our data source -- now all we have to do is drop in the servlet itself. The servlet is a single file with a .WAR extension. We place it in the webapps/ subfolder of Tomcat and that's it! Tomcat will detect that a file was dropped in and will take care of expanding it and installing it.

Check that Saxbi Server is Deployed
Wait a few moments after dropping in the WAR file, and then test that Saxbi Server is setup by visiting its base page. If you are logged on to the Tomcat server itself (such as through an RDP connection or you are using your own workstation), then you can use localhost as your server name in a web browser. Try visiting the following URL:

http://localhost:8080/saxbi-server/

Note that this example assumes that Tomcat is running on port 8080, which is the default Tomcat port. If you have Tomcat installed behind an Apache Web Server, then you may need to access the servlet via port 80, which is the default web port (in which case you don't need to specify it and could use just http://localhost/saxbi-server). If you hav successfully connected to Saxbi Server then you should see a grey page with the Saxifrage Systems logo. This means the servlet is setup correctly but not necessarily that you have your database setup correctly -- so this still needs to be verified.

Check that Saxbi Server can communicate with the repository
Saxbi Server includes a convenience method for quickly checking whether or not the servlet can communicate with the repository. This makes it easy to determine if your JNDI/JDBC configuration is correct without having to go through logs or experience a cascade of errors. Simply visit the following URL (adjust server and port as necessary):

http://localhost:8080/saxbi-server/service/info/dbcheck

If the database is able to be communicated with, you'll receive a simple success message. Additionally, Saxbi Server also checks for the existence of the configuration artifact. This central configuration artifact is necessary in order for Saxbi server to work. Do note that even if the configuration exists it may still need to be adjusted, so you can't assume that everything is working fine.