Seam development with Eclipse and Tomcat Step-by-Step
Tuesday, October 26th, 2010RAD: Seam development with Eclipse and Tomcat Step-by-Step-Tutorial Screencast
Posted by: techiexchange on: November 11, 2007
- In: AJAX | Application Frameworks | Development Tools | EJB 3.0 | Eclipse | Enterprise | J2EE | JSF | Java EE | Jboss | RIA | SEAM | UI-User Interface | Web Application
- Comment!
Jboss Seam, one of the most innovative full-stack web application framework in Java EE era.
Letz dive in to the tutorial directly without explaining more about Seam.
In order to develop an enterprise application, one must have
an application server installed locally, which is a big pain
when considering system resource and performance. During the
development period developer always perfer to have his
code-hotdeploy time as short as possible, which rapidly
increases his development and production. But this is not
easily achieved when application servers are used during
development. An alternative is to use web servers which are
very light when compared to Application servers. Seam has a
good support for Tomcat webserver.
This tutorial focuses Seam development under Tomcat webserver without support for EJB, that means Seam with POJO and JPA+Hibernate as Persistence provider.
Main goal of this tutorial is to achieve RAD-Rapid Application Development with Seam, Tomcat and Eclipse.
Requirements for Seam development envirnoment:
Download latest Seam release
Download Tomcat 5.5 or Tomcat 6
Download latest Eclipse
Download Eclipse-Tomcat-Sysdeo plugin
This is a screencast (static) showing all the screenshots without explanation.
Here we go….
Extract Seam 2 GA distribution on local hard disk (see Figure 1)
JPA example from Seam 2 GA distribution (see Figure 2)
Build JPA example for Tomcat 5.5 by using ant (make sure that ANT already installed) command:ant tomcat55
Building JPA WAR file (see Figure 3)
Once build successfull, then you can find the war file inside dist-tomcat55 folder (see Figure 4)
Now import WAR file to Eclipse to make an Eclipse project (see Figure 5)
In order to import WAR file select Web -> WAR file from Eclipse import console (see Figure 6)
Choose absolute path of jboss-seam-jpa.war file and press next (see Figure 7)
Import all libs from WEB-INF/lib (don’t select any libs) (see Figure 8)
Here’s new project created in Eclipse workspace (see Figure 9)
Create classes inside WEB-INF to build src files (see Figure 10)
Configure the build path so that src folder takes correct classes folder (see Figure 11)
Choose classes folder as default output folder (see Figure 12)
Copy src from Seam-JPA example (see Figure 13)
Paste into the src folder in Eclipse (see Figure 14)
Now src are shown in the hierarchy but with errors (see Figure 15)
Delete ImportedClasses folder in root of Project workspace (see Figure 16)
In order to remove src errors in the project import TestNG lib to WEB-INF/lib (see Figure 17)
Now Project src has been done without any errors (see Figure 18)
Configure Tomcat Sysdeo plugin to installed home directory of Tomcat (see Figure 19)
See Eclipse toolbar for Sysdeo-Tomcat shortcuts – Start, Shutdown, Restart (see Figure 20)
Tell the created Project (jboss-seam-jpa) that it is a web project to Sysdeo plugin (Project ->rightclick-Properties-> Tomcat) (see Figure 21)
Now update/define about project’s context in Tomcat (server.xml will be updated) (see Figure 22)
Open context.xml (inside Webcontent/META-INF) and copy Resource tag (see Figure 23)
Goto server.xml (Tomcat_Home/conf) and see whether project context is defined (see Figure 24)
Paste Resource tag (make sure that Resource is closed properly) copied from context.xml as child tage to Context tag in server.xml (see Figure 25)
In order to work with HSQL DB, copy hsql.jar from Seam distribution to Tomcat-Home/common/lib folder (see Figure 26)
Now all configuration things are over, so Start Tomcat inside Eclipse by pressing Start icon on Eclipse-Sysdeo toolbar (see Figure 27)
You can see the console output of Tomcat saying server started (see Figure 28)
Test whether the application started without any errors by opeing a browser and navigating
http://localhost:tomcatport/jboss-seam-jpa
Note that the footer of the front page. We’re going to change that in the next step. (see Figure 29)
Open home.xhtml (front page of the application) located inside WebContent and check the footer (see Figure 30)
Edit footer note and save the page (see Figure 31)
Now goto opened browser where application is already running, and press Refresh or F5 to reload the page.
That’s it.. without starting the server your code got hot deployed and web page was reloaded. (see Figure 32)
Please note that Tomcat should be used only during development phase in order to increase the development productivity, use some application server to deploy production applications.
I hope this tutorial gives a kick-off project template for Seam with POJO+JPA+Hibernate based application.
Share your thoughts.






























