Apache Commons

from Wikipedia, the free encyclopedia
Apache Software Foundation logo

Apache Commons is a project of the Apache Software Foundation with the objective ofcreatinggeneral class libraries for the Java programminglanguage. Since the libraries are under the Apache License Version 2.0 , they can also be used in commercial projects. The focus is on independence from other libraries and functions relevant to servers. Before the foundation was restructured, the libraries were developed under the name Jakarta Commons .


Since the project consists of a large number of individual libraries, which are limited to a very limited field of tasks, these are differentiated within the project according to their degree of maturity. Libraries that have achieved proper status are an official part of the Commons. Projects that are already functional but do not yet meet the necessary criteria are managed in the sandbox . All other libraries that are still in the design or their care is not guaranteed to be as Dormant (Engl. Dormant) categorized.

The Apache Commons contains the following official (proper) components :

category Components
  • FileUpload - for uploading files to web applications
  • Net - Collection of utilities and protocol implementations for network communication
  • EL - interpreter for the JSP 2.0 Expression Language
  • Email - Library for sending emails from Java
  • Imaging library for reading, parsing and writing various image formats (formerly called Sanselan)
  • Jexl - Expression-Language extension of the JavaServer Pages Standard Tag Library
  • Betwixt - Services for mapping JavaBeans to XML and vice versa
  • Digester - XML ​​to Java mapping
  • Jelly - XML-based scripting and processing engine
  • JXPath - tools for manipulating Java beans using XPath syntax
  • Codec - implementation of generic encoding / decoding algorithms such as Phonetic, Base64, URL
  • Compress - API for working with tar, zip and bzip2 files
Java API extensions
  • Command Line Interpreter (CLI) - Parser for command line arguments
  • Configuration - Access to configuration and preferences files in various formats
  • Collections - Extension of the Java Collections Framework , from version 4 with Generics
  • Database Connection Pool (DBCP) - Services for database connection pools
  • DbUtils - extensions for JDBC
  • Functor - implementation of functional objects, objects that represent functions
  • IO - collection of input / output utilities
  • Java Caching System (JCS) - Framework for distributed caches
  • Lang - Extension of the functionalities of the classes from java.lang
  • Logging - wrapper around a range of logging frameworks
  • Math - components for mathematical and statistical functions
  • Primitives - collections of primitive types in Java without autoboxing
  • Proxy library for creating dynamic proxies
  • VFS - component for handling files, FTP, SMB, Zip etc. as a logical, virtual file system

General libraries

One of the most important libraries is "Commons Collections", which extends the Java Collections Framework with many helpful classes for managing data stocks. The "Commons Lang" library extends the basic functions of the java.lang package , which contains the basic Java classes, with many useful classes and their methods. With the help of “Commons Logging”, a uniform API for the various logging class libraries, such as log4j or java.util.logging, is created. Other general enhancements to the standard Java libraries include:

  • Commons BeanUtils
  • Commons CLI
  • Commons Configuration
  • Commons Math

Web application libraries

Some of the libraries are specially tailored for web applications to make it easier for developers to carry out frequently recurring tasks with little effort. Commons Net provides many well-known protocols such as FTP , POP3 or Telnet , while Commons FileUpload for servlets and web applications provides a simple mechanism for uploading files. The following list shows some other libraries of interest for web applications:

  • Commons IO
  • Commons Transaction

Commons HttpClient is no longer included , as this component was handed over to the superordinate Jakarta project in 2004 and has even been promoted to an independent top-level project since 2007.

XML processing libraries

Since Java Beans are often used on servers , Commons Betwixt offers a mapping of XML structures on Java Beans that is possible in both directions . Commons Digester specializes in the initialization of Java objects from XML data, while Commons Jelly enables the execution of an XML-based scripting language .

Libraries for database access

Apache Commons DB-Utils offers extensions and simplifications for accessing databases using Java Database Connectivity (JDBC). For example, it enables the data supplied from the database to be automatically converted into JavaBeans or automatically closes the database connections. This reduces the necessary database access code to the essential parts, making it easier to understand and maintain.

Opening a database connection can take a long time (sometimes several seconds). This is why most programs access database connection pools which hold several database connections and do not close the connections at the end of transactions, but keep them open for further database access. Apache Commons DBCP offers a pool of database connections based on the Apache Commons Pool, which manages the pool itself.


  • Henrik Hörning, Reidar Hörning, Torsten Curdt: Jakarta Commons . 1st edition. Software & Support, 2004, ISBN 3-935042-60-4 (367 pages).
  • Timothy O'Brien: Jakarta Commons Cookbook . 1st edition. O'Reilly Media, Inc., 2004, ISBN 0-596-00706-X (400 pages).
  • Christian Gross: Applied Software Engineering Using Apache Jakarta Commons . 1st edition. Charles River Media, 2003, ISBN 1-58450-246-0 (350 pages).

Web links

Individual proof

  1. ^ Apache Commons Components