Login | Register
My pages Projects Community openCollabNet

pomstrap
Project home

The Tigris site will receive a major upgrade the evening of Monday, December 1, beginning at 8:30 pm PST. Downtime is projected to be about ten hours. Further details in the announcement

If you were registered and logged in, you could join this project.

Summary POMStrap is an application boostrap based on Maven2 POM
Category deployment
License BSD License
Owner(s) alag

POMStrap is an application bootstrap based on Maven 2 project files (POM) designed to avoid the Java library dependency/version headache. POMStrap allows you clean separation of concern within your application (with component oriented architecture), providing strict hierarchical java classloader confinement.

Release 1.0.12 (revision 115) bugfix release and Alessandro patch applied.
Release 1.0.11 (revision 108) change groupId from pomstrap to org.tigris.pomstrap, support for classifier in pom files.
Release 1.0.10 (revision 96) handles POM properties in dependency building.
Release 1.0.9 (revision 94) added 'pomstrap.loadonce' property and findResource feature in classloader to get resource from maven repository. Also fixe small bugs.
Release 1.0.7 (revision 80) bugfix release.
Release 1.0.6 (revision 74) bugfix release.
Release 1.0.5 (revision 64) bugfix release and small api revision.
Release 1.0.4 (revision 51) feature better properties management, code cleanup and better unit test coverage.
Release 1.0.3 (revision 31) add dependency grouping feature.
Release 1.0.2 (revision 18) fixes lots of bugs and is now used in production for many middle size applications.

POMStrap features:

  • Clean application dependency containment (with classloader for each component) based on Maven POM definition.
  • Simple and lightweight application bootstrap based on POM.
  • Maven 2 application launcher plugin.
  • Servlet and JBoss SAR integration.

Mission

POMStrap is able to launch an application loading all its dependencies as they are declared in Maven 2 project file, and execute each dependency in its own classloader without inhering from its parent avoiding version conflict.

Maven allows you to define via a project file all dependencies of your application. Maven 2 has also a support for transitive dependency: if A depends on B and B depends on C you don't have to declare on A project file the C dependency (C is directly fetched from B dependency declaration).

But Maven 2 doesn't completly fixe (yet) the versioning problem. For example, if your application A-1.0 depends on B-1.0 and C-1.0 and C-1.0 itself depends on B-2.0, you will have a dependency version conflict: the application classloader will provide B-1.0 classes when executing C-1.0 code (instead of B-2.0 as expected).

You can use POMStrap as:

  • a lightweight application bootstrap with command line such: java -jar pomstrap-1.0.6.jar groupId:artifact:version classname[:method] [method args]
  • a Maven 2 plugin: mvn pomstrap:run
  • a Servlet with similar init-parameters configuration
  • a JBoss POMStrap Service allowing you to lauch applications as JBoss Service (via .sar file deployed in a JBoss instance)

POMStrap 1.0.12 source is available for download here.

POMStrap 1.0.12 binary is available here.

POMStrap legacy website is located here.

Related resources and greetings

POMStrap is strongly based on Maven 2 project files. We hope to get approuval from Maven 2 community and have POMStrap merged with current mainstream.

Thanks to Alessandro Evangelista for the bugfix and authenticator enhancement patch.

Misc

Javadoc

POMStrap Javadoc is available here.

Example

Here is an example of classloader dependency graph of a webapp:
[silver:silver:1.0] (22862399)
 +- [ehcache:ehcache:1.2] (16554308)
 +- [org.hibernate:hibernate:3.1.1, org.hibernate:hibernate-annotations:3.1beta8] (28470003)
 |  +- [ehcache:ehcache:1.1] (9142687)
 |  |  +- [commons-logging:commons-logging:1.0.4] (15401342)
 |  +- [cglib:cglib:2.1_3] (11468767)
 |  |  +- [asm:asm:1.5.3] (18916478)
 |  +- [commons-collections:commons-collections:2.1.1] (1012673)
 |  +- [commons-logging:commons-logging:1.0.4] (15401342)
 |  +- [javax.persistence:ejb:3.0-public-draft-20060118] (7901508)
 |  +- [asm:asm:1.5.3] (18916478)
 |  +- [javax.transaction:jta:1.0.1B] (25771774)
 |  +- [dom4j:dom4j:1.6.1] (25609906)
 |  |  +- [xml-apis:xml-apis:1.0.b2] (22996593)
 |  +- [antlr:antlr:2.7.6rc1] (23794631)
 +- [yahoo:yahoo-search:1.1.0] (14651230)
 +- [commons-logging:commons-logging:1.0.4] (15401342)
 +- [xpp3:xpp3:1.1.3.4.O] (20812788)
 +- [org.apache.derby:derby:10.1.2.1] (29140465)
 +- [org.springframework:spring-core:2.0-m2, org.springframework:spring-beans:2.0-m2, org.springframework:spring-support:2.0-m2] (3317565)
 |  +- [org.springframework:spring-jdbc:2.0-m2] (24418135)
 |  |  +- [org.springframework:spring-dao:2.0-m2] (24893089)
 |  |  |  +- [org.springframework:spring-context:2.0-m2] (21491205)
 |  |  |  |  +- [org.springframework:spring-aop:2.0-m2] (22781544)
 |  |  |  |  |  +- [org.springframework:spring-beans:2.0-m2] (33353934)
 |  |  |  |  |  |  +- [org.springframework:spring-core:2.0-m2] (19230370)
 |  |  |  |  |  |  |  +- [commons-collections:commons-collections:3.1] (8548382)
 |  |  |  |  |  |  |  +- [commons-logging:commons-logging:1.0.4] (15401342)
 |  |  |  |  |  |  +- [commons-collections:commons-collections:3.1] (8548382)
 |  |  |  |  |  +- [oro:oro:2.0.8] (26143190)
 |  |  |  |  |  +- [aopalliance:aopalliance:1.0] (26872956)
 |  |  |  +- [javax.transaction:jta:1.0.1B] (25771774)
 |  +- [commons-collections:commons-collections:3.1, commons-collections:commons-collections:3.1] (11120133)
 |  +- [commons-logging:commons-logging:1.0.4] (15401342)
 +- [xstream:xstream:1.1.3] (31454114)
 +- [postgresql:postgresql:8.1-407.jdbc3] (32779081)
 +- [opensymphony:quartz:1.5.0] (21356612)
 +- [googleapi:google:1.0] (8831815)
 +- [log4j:log4j:1.2.8] (25062038)
 +- [commons-dbcp:commons-dbcp:1.2.1] (8889804)
 |  +- [xerces:xerces:2.0.2] (26611461)
 |  +- [xml-apis:xml-apis:2.0.2] (11807935)
 |  +- [commons-collections:commons-collections:2.1] (15054627)
 |  +- [commons-pool:commons-pool:1.2] (22710119)
 |  |  +- [xerces:xerces:2.0.2] (26611461)
 |  |  +- [xml-apis:xml-apis:2.0.2] (11807935)
 |  |  +- [commons-collections:commons-collections:2.1] (15054627)
 +- [rhino:js:1.6R2] (7306473)

The number next to the name represent the classloader hashcode. As you can see, dependency of the same maven groupid are in the same bag. Also for same dependency bag the same classloader is used.

You can have here different version of "commons-collections" used in this application without side effect.

Known limitation

As dependencies of same groupid are used in a distinct classloader, you might encounter problems when trying to access protected method of class in same package but in different dependency group (a jar file from another maven groupid).

There is no simple solution to this problem since it is a java security protection to avoid malicious code execution (see http://www.artima.com/insidejvm/ed2/security2.html).