How to Make JBoss Seam Work with Eclipse (for Windows)

DZone 's Guide to

How to Make JBoss Seam Work with Eclipse (for Windows)

· Java Zone ·
Free Resource

This is a step-by-step tutorial. I made this Tutorial, because I was not happy with the four project folders generated by JBoss Tools 2.0.0 when I select a new Seam EAR project. The work is a bit confusing. If I create a new Seam WAR project I only get two projects (one of them is a test project). I had a lot of trouble with the WAR project. I was not able to not get the EJB3 examples work with it. Never the less the folder structure is different from the Seam-gen generated projects. This tutorial works completely without JBoss Tool. You can use JBoss Tools anyway, it has nice functions do build a RichFaces JSF page, but keep in mind that new generated projects are difficult to handle, since you have to keep an overview of all four projects and the changes you made in each of them.

Download and extract the files


First of all you need to download a few things.

Eclipse for Java EE Developers (second entry)

Try to download the last GAs from the JBoss websites.

JBoss Seam 2.0.X (of course)

And the JBoss Application Server 4.2.X

And you will need a database, I used MySQL. Download the proper JDBC Driver

Extract these files where you like but keep in mind not to use blanks ” ” or special characters “áä”.
I used “C:\Development” as path. Create a new workspace folder here.

Now the folder should look like this:


Download and install Database

Download the MySQL Database from this Page

Next we need to get our database up and running.

Run the setup and make a “typical” installation. At the end of the setup configure the MySQL server. Choose “Standard Configuration”. Do not change anything in the next screen. Now set root password for the DB. I used “mysql” at this point (very inventive, huh?). Go to the next screen and finish the configuration.

Setup JBoss Seam and create a new project

You need to create a new Seam project

Enter the Console, Start => Run an enter “cmd”
Enter “C:” and change the Directory to the JBoss Seam installation
“cd C:\Development\jboss-seam-2.0.X.GA”.

Now it is time to setup JBoss Seam.

Type: “seam setup”

Seam welcomes us but wants to know some things about our project.


Enter the project folder. That will be our workspace

Enter the Directory of the JBoss Application Server

Give the Seam project a name.

RichFaces is fine. Hit enter.

The BlueSky Theme is fine, too. Hit enter.

EAR, ok. Hit enter

Enter the package name of your session beans.

Enter the package name of your entity beans.

The package for the test cases is ok. Enter.

I use MySQL, so I enter “mysql”.

Dialect is ok. Enter.

Enter the path to the JDBC driver. In this case it is


This is the driver class, hit enter.


Now it gets a bit tricky. Enter the connection URL to your Database.

I used the test database in my MySQL installation.
The username was “root” and the password “mysql”.

There is no DB catalog in this case. Enter.

There are no tables so far. Enter.

I want to keep my tables. Enter.

The setup is finished. That was a lot of work, so where is my project?
There is no project till now.

Enter “seam create-project”

There it is!

Seam finished


That’s enough console hacking for now.

Start Eclipse


Start Eclipse and choose our workspace “C:\Development\workspace”.

Close the welcome screen (if you already haven’t)

Create a new Java project. File => New => Project.. => Java => Java Project

Choose “Create project from existing source” and enter the Seam project path “C:\Development\workspace\MyFirstSeamProj”.

Enter Project Name “MyFirstSeamProj” and click “Finish”.


Switch to Java EE perspective (top right)

Click on the “Servers” tab. Right click and create a new one.

Choose JBoss v4.2, than next. Enter Application Server directory “C:\Development\jboss-4.2.2.GA”, than click “Finish”.

Start the Server by right click, “Start”.

Open the project, right click the ant file “build.xml” and click “Run as” => “Ant Build”.

An error appears! Why? The Windows file system does not like a file and a directory with the same name.


Stop the server.

Open the Explorer and go to “C:\Development\jboss-4.2.2.GA\server\default\deploy” and delete the MyFirstSeamProj.ear folder.

Let’s try again. Start the server. That’s a bit better.


Error solved

Now it is time to open the page of our new Seam project.

Open the browser and enter http://localhost:8080/MyFirstSeamProj/

There it is, your first Seam project!



Get the example running


Now it is time to test a Seam example. I used the simple “Registration” example.

Go to “C:\Development\jboss-seam-2.0.1.GA\examples\registration”
The source files are in “\src\org\jboss\seam\example\registration”

Copy Register.java, RegisterAction.java and insert it in your Eclipse project at src/action in the package “com.mydomain.MyFirstSeamProj.session”.

Another error appears! Well not really, it is the same as before, but now we have got an additional window

New error

It is the Windows file system again.

Go to “C:\Development\jboss-4.2.2.GA\server\default\deploy” again and delete the “MyFirstSeamProj.ear” FILE this time. The error should now be solved.

Go back to the Eclipse project and make a new package in “src/model” and name it “com.mydomain.MyFirstSeamProj.entity”. Copy “User.java” from the example in this package.

Now you must correct the package entry in the source files in your eclipse project to “com.mydomain.My…”. In “RegisterAction.java” you have to import User from “com.mydomain.MyFirstSeamProj.entity.User”. Save all files.

Go to the root directory of the Registration example and copy all files from the view folder into the view folder of your eclipse project and override the existing.

The deploy method is explode, what does this mean?

Open your browser and to http://localhost:8080/MyFirstSeamProj/ again.

The Seam Registration example is already running.


But to be sure that nothing went wrong, stop and start the server in Eclipse again.

Now you can register a new user in the browser and look into your database with the query browser.



Everything works, very good.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}