How to install JDBC drivers and SAP JCo on Apache Tomcat properly

Developing web applications on Apache Tomcat is very easy including ones interact with DBMS or even SAP. The key component is JDBC driver and SAP JCo. However, common problem is about deploying the application. If you installed JDBC driver or SAP JCo improperly on Apache Tomcat, you may run it as long as you don't redeploy the application again. Whenever you redeploy the application or deploy another application using the same driver, all applications will crash immediately because the driver was not loaded properly (it was already loaded).

According to Class Loader HOW-TO, there are at least 2 level of class loader.

  1. For classes and resources specific to a particular web application, place unpacked classes and resources under /WEB-INF/classes of your web application archive, or place JAR files containing those classes and resources under /WEB-INF/lib of your web application archive.

  2. For classes and resources that must be shared across all web applications, place unpacked classes and resources under $CATALINA_BASE/shared/classes, or place JAR files containing those classes and resources under $CATALINA_BASE/shared/lib.

So all *.jar of JDBC drivers and SAP JCo must be in $CATALINA_BASE/shared/lib to make it work perfectly.

Tags: , , ,

Reply