deegree webservices is a Java web application and based on code written in the Java programming language. As a user, you usually don’t need to care about this, unless you want to extend the default functionality available in a deegree webservices setup. This chapter provides some basic knowledge of JAR (Java archive) files, the Java classpath and describes how deegree webservices finds JARs. Additionally, it provides precise instructions for adding JARs so your deegree webservices instance can connect to Oracle Spatial and Microsoft SQL Server databases.
Hint
The terms JAR, module and library are used interchangeably in this chapter.
Java code is usually packaged in JAR files. If you want to extend deegree’s codebase, you will have to add one or more JAR files to the so-called classpath [1]. Basically, there are two different types of classpaths that determine which JAR files are available to deegree webservices:
The full classpath used by deegree webservices consists of the web application classpath and the workspace classpath. If conflicting files exist on both classpaths, the file on the workspace classpath takes precedence.
Tip
If you’re not familiar with classpath concepts and don’t have any special requirements, simply add your JAR files to the workspace classpath and ignore the web application classpath.
As deegree webservices is a Java web application, standard paths apply:
When you add files to the web application claspath, you have to restart the web application or the web application container to make the new code available to deegree webservices.
Hint
All Java libraries shipped with deegree webservices are located in the WEB-INF/lib directory of the deegree webservices webapp. If you downloaded the ZIP version, this directory is located in webapps/ROOT/WEB-INF/lib.
When deegree webservices initializes the workspace, it scans directory modules/ of the active deegree workspace for files ending with .jar and adds them to the classpath. This can be very handy, as it allows to create self-contained workspaces (no fiddling with other directories required) and also has the benefit the you can reload the deegree workspace only after adding your libraries (instead of restarting the deegree webapp or the whole web application container).
Hint
In addition to workspace directory modules/, directory classes/ can be used to add individual Java classes (and other files) to the classpath. This is usually not required.
In order to see which JARs are available to your deegree webservices instance/workspace, use the “module info” link in the general section of the service console:
The list of JARs section displays the JARs found on the web application classpath, while the lower section displays the JARs found on the workspace classpath.
By default, deegree webservices includes everything that is needed for connecting to PostgreSQL/PostGIS and Derby databases. If you want to connect to an Oracle Spatial or Microsoft SQL Server instance, you need to add additional Java libraries manually, as the required JDBC libraries are not included in the deegree webservices download (for license reasons).
The following deegree resources support Oracle Spatial databases (10g, 11g):
In order to enable Oracle connectivity for these resources, you need to add two JAR files (see Java code and the classpath):
The following deegree resources support Microsoft SQL Server (2008, 2012):
In order to enable Microsoft SQL Server connectivity for these resources, you need to add two JAR files (see Java code and the classpath):
Footnotes
[1] | The term classpath describes the set of files or directories which are used to find the available Java code (JARs and class files). |
[2] | http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html (registration required) |
[3] | http://repo.deegree.org/content/repositories/public/org/deegree/deegree-sqldialect-oracle/3.3.10/deegree-sqldialect-oracle-3.3.10.jar |
[4] | http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx |
[5] | http://repo.deegree.org/content/repositories/public/org/deegree/deegree-sqldialect-mssql/3.3.10/deegree-sqldialect-mssql-3.3.10.jar |