Create a simple web application with Seam Forge Beta1, JBoss AS 7, Metawidget und RichFaces 4

The way to create a new project had changed since the last Seam Forge alpha-releases. The syntax is a bit differnt now. I use this configuration:

Open a command shell and start the JBoss AS with ..\jboss-as-7.0.0.Final\bin\standalone.bat (or standalone.sh within linux)
Start SeamForge with 'forge' in the forge-1.0.0.Beta1\bin-directory and let's begin.

The short story:

[no project] bin $ cd C:\Users\myuser\workspace
[MyApp] workspace $ new-project --named TestForge --topLevelPackage de.test
 ? Use [C:\/Users/myuser/workspace/TestForge] as project directory? [Y/n] Y
[TestForge] TestForge $ persistence setup --container JBOSS_AS7 --provider HIBERNATE
  34 - [org.hibernate:hibernate-entitymanager:::3.6.6.Final]
 ? Choose an option by typing the number of the selection [*-default]:  34
[TestForge] TestForge $ entity --named Person --package de.test.entity
[TestForge] Person.java $ field string --named firstname
[TestForge] Person.java $ field string --named surname
[TestForge] Person.java $ field int --named age
[TestForge] TestForge $ cd ..
[TestForge] TestForge $ scaffold setup --scaffoldType metawidget
 ? Scaffold provider [metawidget] is not installed. Install it? [Y/n] Y
 ? Facet [forge.maven.WebResourceFacet] requires packaging type(s) [war], but is currently [jar]. Update packaging? (Note: this could deactivate other plugins in your project.) [Y/n] Y
Install which version of Metawidget?
  4 - [org.metawidget.modules.faces:metawidget-faces:::1.25]

  ? Choose an option by typing the number of the selection: 4
Install which version of Seam Persistence?

  1 - [org.jboss.seam.persistence:seam-persistence:::3.0.0.Final]
 ? Choose an option by typing the number of the selection: 1
 ? [C:\/Users/myuser/workspace/TestForge/src/main/webapp/index.html] File exists, overwrite? [Y/n] Y
[TestForge] TestForge $ forge git-plugin git://github.com/forge/plugin-richfaces.git
[TestForge] TestForge $ exit
Start Forge again and go into the project directory...
[TestForge] TestForge $ cd C:\Users\myuser\workspace\TestForge
[TestForge] TestForge $ setup richfaces
  Which version of RichFaces?

  1 - [RichFaces 4.0.0.Final]

  ? Choose an option by typing the number of the selection: 1    
 ***ERROR*** [richfaces setup] null

Oops there was an error(maybe a bug), let's do manually.
We need:
  • in the file ...\workspace\TestForge\src\main\webapp\WEB-INF\metawidget.xml look for 'Only if using RichFaces' and uncomment the lines behind that
  • in ...\workspace\TestForge\pom.xml add the dependency:
  • in ...\workspace\TestForge\src\main\webapp\WEB-INF\web.xml paste:
        Faces Servlet
        Faces Servlet
In SeamForge again:
[TestForge] TestForge $ cd C:\Users\myuser\workspace\TestForge
[TestForge] TestForge $ scaffold from-entity  de.test.entity.Person.java
 ? No scaffold type was selected, use default (Metawidget & JSF)? [Y/n]Y
[TestForge] TestForge $ build
[TestForge] TestForge $ as7 deploy

With the m2eclipse-Plugin you can import the project in Eclipse by selecting File->Import...->Maven->Existing Maven Project

Open http://localhost:8080/TestForge/scaffold/person/create.jsf in your browser and enjoy.

I found a documentation @jboss.org, take a look for more information: Generating a basic Java EE web-application


  1. I followed your steps religously and ended up with a JBoss 7 deployment failure:
    Error getting reflective information for class org.metawidget.jsp.tagext.html.spring.SpringMetawidgetTag
    caused by: NoClassDefFoundError: org/springframework/context/MessageSource
    caused by: ClassNotFoundException: org.springframework.context.MessageSource .....

    The root cause is an unresolved problem with JBoss 7 (not a bug in earlier versions):
    The problem is discussed but not resolved at https://issues.jboss.org/browse/SEAMFORGE-156 in which the author of metawidgets identifies the issue and suggest a resolution involving fixing a Jboss 7 bug (below).
    https://issues.jboss.org/browse/AS7-708 describes the JBoss 7 bug that prevents metawidgets-all.jar from deploying error free. It has not been fixed for JBoss 7.0.2.Final.

    How did you manage to make your "Person" example work using JBoss 7 ?

  2. I created a new post and tried Seam Forge Beta3, JBoss AS 7.0.2 and Metawidget. Please take a look. The pom.xml contains the artifactId metawidget-forge-scaffold.
    So the problem with the artifactId metawidget-all should not appear anymore.