DataBinder Installation


(On Debian)
See guide here:

First you need Java 1.5 installed with JAVA_HOME in the classpath and JAVA_HOME/bin in your PATH

The "easy" tongueOut way to install databinder is with Maven2, which is a project/build tool (like ant or make but fancier smile ), that will fetch for you all the databinder dependencies (jars) automatically.

I did not have that on Debian, and it's not available in the default apt repositories, so i had to install Maven2 first (from source)

Maven2 Installation

get the latest maven2xx.tgz from here:
and save it on disk.

WARNING for databinder < 0.6 the project creation will fail if using maven 2.0.4, so get 2.0.2 preferably

extract the archive to /usr/local
cd /usr/local
sudo tar -xzvf /home/downloads/maven2xx.tgz

Add maven2/bin to your path
On my debian i added in ~/.bashrc along with JAVA_HOME
export PATH=/usr/local/maven-2xx/bin:$PATH

Then we can evrify that maven is found and running
source /etc/environment
mvn --version
#should return "Maven Version 2.xx"

Fetching the dependencies

The JTA jar from Sun can't be retrieved by Maven (licensing issue), so we need to get it manually first:

Go to:
to get the JTA interfaces from the Download link next to “Class Files 1.0.1B”.
Save in your download directory

Then get maven to use those jars and retrive all the other dependencies automatically.

cd /home/downloads
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar

maven seem to fail sometimes, just run it again.
Maven should then fetch and install the needed dependencies.

We still need to install separately the Hibernate Annotations support:
Get it from here:
and save it to disk, then run:
cd /home/download
tar xzvf hibernate-annotations-3.1beta8.tar.gz
cd hibernate-annotations-3.1beta8
cd lib
mvn install:install-file -DgroupId=javax.persistence -DartifactId=ejb -Dversion=3.0-public-draft-20060118 -Dpackaging=jar -Dfile=ejb3-persistence.jar
# should return "build successful"

Creating a DataBinder project

Go in the directory where you want to have your project (! in eclipse workspace)
Run the foolowing command, make sure you replace:
- example by your company (
- myExample by the project name (ie: testProject)
cd /home/me/
mvn archetype:create -DarchetypeGroupId=net.databinder -DarchetypeArtifactId=data-app -DarchetypeVersion=0.3 -DgroupId=example -DartifactId=myExample

Note As of 03/21/06 it seem taht when creating a project, it creates a dependency to DataBinder 0.2 (old), fix that by editing the pom.xml and changing 0.2 into 0.3. The project owner as been noticed, so it probably will be fixed soon.

Define the Hibernate DB

Define your database here (if you use mysql, you probably only need to edit the user/password) or even nothing if you don't authenticate local DB connections:
vi testProject/src/main/resources/

Check that it runs

cd /home/me/testProject
mvn compile jetty6:run

The first time it will take a while since it will have to download the Jetty J2EE container, etc... and dependencies)

Then browse to:

You should see "my Project" displayed orange.

Now we can try modifying the page and see that it recompiles:
Leave Maven/Jetty running and go edit the java file, and recompile
# Ran this in a new shell
cd /home/me/testProject
vi src/main/java/mycompany/
# change the getName() method to return something new. (ie: "i changed this!")
mvn compile

Since we let the other maven/jetty run, it's still up.
It should automatically pickup the chnages
reload: http:

It should now display our new text (ie: "i chnaged this!")

Eclipse Integration

Let's get the eclipse project created using maven:
cd /home/me/testProject
# adjust the path to your env.
mvn -Declipse.workspace=/home/me/workspace eclipse:add-maven-repo
# and this line to setup/fetch the required libraries
mvn -Declipse.downloadSources=true eclipse:eclipse

Ok, now we are ready to use this in Eclipse !

Start Eclipse
You might want to install the jetty plugin:
Follow: if you want to.

Import the project into Eclipse:
Click "file"/"import"/"existing project into workspace"
browse to /home/me/testProject and press "finish"

You should now have the project avail. in your workspace in Eclipse.

Now we can go see some Examples:

and start coding tongueOut

Upgrade to 0.4

There is now a new version 0.4, see the guide here to upgrade to 0.4



Add a new Comment