5.2. Adding JARs to the Repository

Geronimo has a repository service to accommodate additional libraries that may be required by the services, resources, or applications it runs. You may want to add entries to the repository in order to:

Under the covers, the repository is saved to a directory in the Geronimo installation. If you look at the geronimo-1.1/repository directory, you'll see something like this:

Figure 5.1. Geronimo Repository Layout

Geronimo Repository Layout

The JARs for the common libraries are each stored under a directory based on the Module ID for the JAR (for more on Module IDs, see Section 4.1.1, “Module IDs”). As you can see for the MySQL driver in Figure 5.1, “Geronimo Repository Layout” (with Module ID mysql/mysql-connector-java/3.1.12/jar), the location of the JAR is repository/group/artifact/version/artifact-version.type under the Geronimo installation directory.

It's possible to manually add files to the repository, by following the exact naming convention described above. However, it's not always easy to get this right. Therefore, the best way to add entries to the repository is to use the Common Libs screen in the administration console, which lets you specify the various components of the module ID for a JAR, and then it will install it into the correct location in the repository.

[Tip]Tip

In the case of JDBC drivers, the Database Pools wizard in the console can automatically download and install certain JDBC drivers, which avoids this problem altogether. For other (generally commercial) JDBC drivers, or for other type of common libraries, you can use the procedure described here.

Example 5.1, “Installing a JDBC Driver into the Repository” walks through the process of installing a new JAR into the repository, using an Oracle JDBC driver JAR as an example.

Example 5.1. Installing a JDBC Driver into the Repository

Start by going to the Common Libs directory in the console:

Next select the JAR from the local filesystem using the Browse... button, and the console will guess at the components of the module ID for this JAR. How well it does depends on the structure of the JAR name to begin with:

In this case, the guess was not very good. We'll overwrite the Group, Artifact, and Version fields to use the module ID oracle/jdbc/10.2.0.1/jar for this JDBC driver:

Click Install and the JAR will be installed into the repository. Now we can use it to create a database connection pool. Or, more commonly for other types of JARs, an application could declare a dependency on this JAR to add it to the application class path.