Seam-gen on Glassfish – part I

I recently managed to get a seam-gen app running on Glassfish. To share how this was done, i’ve divided this blog in 3 parts. This part will handle most of the prerequisite steps.

The complete setup

  • Ubuntu 9.10
  • Mysql server 5.1
  • Glassfish v2.1.1
  • Jboss Seam 2.2.1.CR1
  • Netbeans 6.8
  • Ant 1.7.1
  • Subversion 1.6.5

Jboss Seam and the Glassfish server will be installed under ~/opt.

1. Install JDK 6

First of all you need to install a recent JDK version

$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

Note: if you’re using ubuntu10 you need to enable the “partner” repository first. This is done via the System > Administration > Software menu.

2. Install Mysql Server 5.1

Next we’re gonna install mysql server on ubuntu

$sudo apt-get install mysql-server

3. Install Subversion (optional)

For versioning support we’ll be using subversion with http support

$ sudo apt-get install subversion
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-svn

3a. Create repository

Next we’re gonna create a svn repository

$ sudo svnadmin create /var/svn/repos

3b. Edit svn configuration

Edit the subversion configuration

$ sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

Alter this so that effectively when ignoring all comments it’ll look like this

<Location /svn>
    DAV svn
    SVNPath /var/svn/repos
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd
</Location>

3c. Create a svn user

We need a user to connect to the svn repository

$ sudo htpasswd -cm /etc/apache2/dav_svn.passwd <user_name>

When prompted enter a pasword.

3d. Restart Apache

$ sudo /etc/init.d/apache2 restart

3e. Change repository owner and rights

You need to change the owner and add some group rights on the repository files, or else you’ll get an error when commiting changes tot the repository over http.

$ sudo chown www-data:www-data  /var/svn/repos -R
$ sudo chmod g+w /var/svn/repos -R

Finally you can test if you can connect to your repository via the url http://127.0.0.1/svn

4. Install Netbeans 6.8

Download the installer file Netbeans

$ chmod +x <installer-file-name>.sh
$ sudo ./<installer-file-name>.sh

Accept the defaults. Netbeans will be installed in the /usr/local directory.

5. Install Glassfish 2.1.1

Download the installer file Glassfish v2 into a temporary directory

$ java -Xmx256m -jar <installer-file-name>.jar
$ mv glassfish ~/opt/glassfishv2
$ cd ~/opt/glassfishv2
$ chmod -R +x lib/ant/bin
$ ./lib/ant/bin/ant -f setup.xml

Note: To prevent future problems when the jdk version get updated make sure, that glassfish uses the symbolic link to the jdk installation.
The JDK home is set in the file <glassfish_home>/config/asenv.conf. It should read:

AS_JAVA="/usr/lib/jvm/java-6-sun/jre/.."

6. Install Jboss-seam

Download the latest seam distibution from the Seam website and unzip it into ~/opt/

7. Install Ant

$sudo apt-get install ant

If you’ve come this far, you”ll have all the components you need to get started with seam-gen!!

Advertisements

About Roger Goossens
I'm an integration consultant with a strong affiliation for JEE and open source development.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: