How to Create a New Seam Web Project in Eclipse

In this exercise we will be building seam web project in eclipse. It's long so stay focus :-D. What you need (The following should b...

In this exercise we will be building seam web project in eclipse.

It's long so stay focus :-D.

What you need (The following should be installed correctly):
Note: in parentheses is where I installed mine.
1.) Jboss seam 2.2.1 (C:\jboss-seam-2.2.1)
2.) Jboss AS 5.1.0 (C:\jboss-5.1.0)
3.) eclipse-jee-helios (with jboss tools plugin installed) (C:\eclipse\eclipse-jee-helios)
4.) mysql (C:\mysql51)
5.) mysql jdbc driver (C:\lib\mysql-connector-java-5.1.14-bin)

1.) Creating the database
  1.) Open up your favorite MySql GUI tool, for this exercise I'm using sqlyoq
  2.) Create a database seamdemo
  3.) Add a table person, with the following column (you can edit if you want)
  person(id, first_name, last_name, birthdate, sex)
  4.) You can add a record or 2

2.) Create a new seam web project in eclipse-helios
  1.) Select File->New->Other, Select Seam->Seam Web Project
2.) In the Project Name enter SeamWorld
  3.) We need to create a Server Runtime Environment.
    1.) In the Target Runtime panel, select New Runtime
    2.) Select JBoss 5.1 Runtime
3.) In the JBoss Runtime window
      1.) Point the Home Directory to JBoss Server
      2.) JRE -> jre6
      3.) Configuration -> Default
      4.) Click finished
4.) We need to define the Target Server
    1.) In the Target Server panel click New
    2.) Click JBoss AS 5.1, click next
    3.) Select Local in Server Behavior
5.) Select the project you wish to add, then click finish. The final screen should look like:
6.) Click next
  7.) In the Web Module, dont change anything click next
  8.) JSF Capabilities, click next
9.) Seam Facet, we need to setup the mysql database connection here
    1.) In the Seam Runtime, select the folder where we installed seam 2.2.1
    2.) Database Type -> Mysql5 (Innodb)
    3.) Click New Connection Profile
      1.) Select MySQL
      2.) Click the + sign in the right side of the Drivers:
      3.) Select MySQL JDBC Driver 5.1
      4.) In the Jar List, select the mysql jdbc driver in the c:\lib      
     4.) Click ok
10.) Driver connection should look like this:
    1.) Database: seamdemo
    2.) URL: jdbc:mysql://localhost:3306/seamdemo
    3.) Update the User name and Password
    4.) Click Test Connection to verify that you have successfully setup the connection profile
    5.) Click Finish
11.) In the Seam Facet window
    1.) Database Catalog Name: person
    2.) Check DB Tables already exists in database
12.) Click Finish. It should look like this.
13.) Now we will create the entities
    1.) Right click on the project->New->Seam Generate Entities
14.) Click Reverse Engineer from Database
15.) Click next,then Click Refresh. The seamdemo database should appear
    1.) Include person table
    2.) Click Finish
16.) Now we need to create a new Seam Conversation
    1.) Right click on the project->New->Seam Conversation
    2.) In the Seam Component Name enter seamWorld
    3.) Click Finish
17.) Right click on project
    1.) Select Run As
    2.) Select the configuration we have just made (JBoss Runtime)
    3.) The screen should look like:


java-getting-started 7408214607776623033

Post a Comment Default Comments


Unknown said...

I followed your example to the letter but when I click on "browser data" and then on the list to generate, I find an exception " org.jboss.seam.InstantiationException: Could not instantiate Seam component" , help me please.

Unknown said...

or; that is what it misses!!

Anonymous said...

remove files in exploded folder and the files generated in dist folder. once it is done run the project again.

Anonymous said...

dnt know wht the exact reason is. but when ur doing changes to entities always need to remove files in above folders and re-generate it again

Anonymous said...

hi i have a prolem whan a try to build a new seam project i 'm creating a seam web project in first run it is ok but when i add a seam entity to project and run; it appears an error(/layout/menu.xhtml @10,85 propagation="none" java.lang.ClassCastException@1f93f8) error in menu.xhtml but i did not change anything in that file

Anonymous said...

i have the same problem propagation = null error but i have no idea how to solve please send ansfeel i you have any idea

Unknown said...

Greate tutorial everything is working if you follow the instruction.
JUST in step 11 I enteren 'seamdemo' instead of 'person' as Database Catalog Name otherwise step 15 won't get connceted to Database.