Using versioned third party libraries on Wildfly 10

Wildfly comes with the the best module management for managing classloading of your deployed application.

1. Create new folder structure for the new driver, $WILDFLY_HOME/modules/org/postresql/9.4

2. Create the corresponding module.xml as below.

3. Add a driver based on the new module

Note the module is specified as org.postgresql:9.4 to specify the specific slot/version we want to use. If not specified Wildfly will user the default slot/version, main.

4. Use the driver in your datasource by specifying the driver as postgresql94


I have a multi module Maven based web application project with a hibernate-annotations dependency that was failing to compile. I was getting the compilation error below:

[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
Failure executing javac, but could not parse the error:
An exception has occurred in the compiler (1.6.0_22). Please file a bug at the Java Developer Connection ( after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.$CompletionFailure: class file for org.hibernate.annotations.CacheConcurrencyStrategy not found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------

Changing the dependency scope from provided to compile fixed the issue, but that would add unnecessary jars in the EAR that are already provided by the server, causing classloading errors on JBoss.

It turns out maven-compiler-plugin 2.3.2 has a bug, switching to 2.1 solves the issue.

Other modules that depend on the module with hibernate-annotations dependency will also have to explicity add hibernate-annotation dependency as provided.


Installing Postgres on Ubuntu 10.10

Installing postgres on Ubuntu 10.10

sudo apt-get install postgres pgadmin3

Now try to connect to postgres Applications > Programming > pgAdmin III

You will get the error below.

Postgres login error

It turns out Postgres setup is not complete yet. In MySQL you will be ready to go, root with an empty password, certainly not good for security

Switch to postgres and set the password

sipatha@lpt1:~$ sudo -u postgres psql
psql (8.4.5)
Type "help" for help.

postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q

Now try again logging in using pgAdmin III

We good to go!

Tagged with:  

Generating an EAR project for enterprise application

I’m migrating a J2EE 1.3 application to JEE5, from Ant to Maven. I couldn’t find a simple archtype that would allow me create a simple and clean directory structure like the one below. All the existing ones add a lot on directories which frankly i failed to comprehend (maven newbie). Another solution would have been to create a parent project and create modules.

JEE5 project structure

I stumbled upon javaee5-maven-archetype which allowed me to create exactly what i was looking for. I have a simple project structure thats easy to build (and break, and fix). It has a some batteries included 😉 Download it, install into you local repo, you are good to go. See Usage

Tagged with:  
© 2011 - Pass me the Mic