The Holy Java

Building the right thing, building it right, fast

Archive for October, 2006

RAD: Server Configurations in Rational Developer 6.0: copy, repair…

Posted by Jakub Holý on October 19, 2006

This article describes some tricks you can do with RAD’s server configurations (mostly for WebSpehere App.Server/Portal Server).

1. Problem: Create a new server config based on an old one.

 The view “Servers” only permits to create a new server configuration (R mouse – New – Server). To create it based on an existing configuration (called further “source config”):
Create a new server config, name it somehow. Exit RAD.
Goto <WORKSPACE>/.metadata/.plugins/ and find the id of the new configuration and theid of the source config. in configurations.xml
Copy the directory <WORKSPACE>/.metadata/.plugins/<source config id>-data to the neighbouring <new config id>-data
Start RAD, make the adjustements needed.

2. Remove a project from config’s applications by force

Go to <WORKSPACE>/.metadata/.plugins/<the config id>-data/ (see above how to find the id): remove any reference to the given project in memento.xml and delete the sub-directory cells\localhost\applications\<project name>
It may also help to clear all tmp*/ directories under <WORKSPACE>/.metadata/.plugins/

The steps above likely aren’t necessary. The only necessary thing is to remove the entries from:
 <WORKSPACE>/.metadata/.plugins/<the config id>-data/cells/localhost/nodes/localhost/serverindex.xml
!!! Don’t remove wmmApp – the server will fail to start w/o it.

Posted in eclipse | Comments Off on RAD: Server Configurations in Rational Developer 6.0: copy, repair…

DB2: Find out current locks, long transactions etc. [snapshot]

Posted by Jakub Holý on October 19, 2006

To find out current locks in a DB and other information about its current state, you need to take a “snapshot”:

db2 "attach to  user  using "
db2 "get snapshot for applications on "  > mydatabase_snapshot.txt

Look into the resulting mydatabase_snapshot.txt for “Application ID holding”  (if there is a lock, this will read the ID of the aplication holding the lock). To find long queries [that are currently running], look for “Executing”.

Posted in Databases | Tagged: , , | Comments Off on DB2: Find out current locks, long transactions etc. [snapshot]

Ant/Maven: Add build date/revision to the generated JAR’s Manifest

Posted by Jakub Holý on October 19, 2006

I’ll explain how to get build time info and svn revision into the buildedjar/ear in Maven or Ant.

1. Maven

If you want to have the build date of a JAR built by Maven in its Manifest
file, paste the following lines at the beginning of your maven.xml:

<j:set value="JarBuildDate var="maven.jar.manifest.attributes.list" />
<j:set value="${DSTAMP}" var="maven.jar.manifest.attribute.JarBuildDate" />


  1. <tstamp/> executes the Ant’s task Tstamp, which
    defines the variables DSTAMP (date in the form YYYYMMDD), TODAY (MMMM dd
    yyyy) and TSTAMP (hhmm).
  2. The property maven.jar.manifest.attributes.list tells the
    jar:jar goal what entries to add into the resulting manifest. Attention:
    value=”JarBuildDate” and =” JarBuildDate” define 2 different variables,
    i.e. whitespaces are very significant. You must also comply with the
    definition of valid manifest entriy names. The variable may hold multiple
    entries separated by a comma. Side note: what happens, if the variable is
    already set? Is the old value preserved or overwritten?
  3. maven.jar.manifest.attribute.JarBuildDate sets the value
    for the manifest entry defined in the …list property.

2. Ant

<!-- Create manifest with build time info -->
<manifest file="ear-MANIFEST.MF">
                 <attribute name="MyBuild-Date" value="${DSTAMP}" />
                 <attribute name="MyBuild-Time" value="${TSTAMP}" />
                 <attribute name="MyBuild-Svn-Revision" value="${svn.version}" />

<jar manifest="ear-MANIFEST.MF" .. /> <!-- the same for an <ear .. -->

Explanation: It’s basically the same as for maven. The task ‘manifest’
generates a manifest file.

3. Get SVN revision

Warning:This only works with the plain-text format of .svn/entries, not with the older XML format.

To get an SVN revision of you project at the time of building, you can use
the following task to get the revision number into the property svn.version
(requires ant >= 1.6):

   property="svn.version" srcFile=".svn/entries" failonerror="true">
      <headfilter lines="6"/>
         <replaceregex pattern=".*[\r\n]+dir[\r\n]+([0-9]+)[\r\n]+http://.*"
            flags="s" replace="\1"/>

.svn/entries is a SVN file having something like this somewhere at its


  • headfilter takes first 6 lines of the file
  • filetokenizer gets all those lines into 1 string
  • replaceregexp finds the revision number in it and replaces
    all the string with this number
  • the result is stored into the property svn.version

Posted in Tools | 2 Comments »