Wednesday, July 1, 2009

JBoss Seam Archetype - now with ICEfaces

Last week I visited Jazoon - and had a great opportunity to see several impressive demos of ICEfaces! Of course I had to immediately get my hands on it, and started to integrate ICEfaces in the JBoss Seam Maven archetype (as described in my previous post).

You can give it a spin by starting a shell and running Maven with the Archetype plugin:

>mvn archetype:generate -DarchetypeCatalog=http://tinyurl.com/jbsarch -DajaxLibrary=icefaces
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
...
Choose archetype:
1: http://tinyurl.com/jbsarch -> jboss-seam-archetype (Archetype for JBoss Seam Projects)
Choose a number: (1): 1
Define value for serverDir: : [your JBoss 5 server location]
Define value for groupId: : [your groupId]
Define value for artifactId: : [your artifactId]
Define value for version: 1.0-SNAPSHOT: : [your version]
Define value for package: : [your package]
Confirm properties configuration:
serverType: jboss5
ajaxLibrary: icefaces
...
Y: : y
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
...


Make sure you don't misspell "icefaces", this will otherwise screw up the application. No input validation in Maven Archetype yet, but I started looking into it ;-)

Again, change to the project directory and build the project:

>mvn package

Now this also executes a sample unit test (fingers crossed it works this time ;-) - thanks to Oscar for the feedback!

Have fun with it! Anybody mind contributing a decent layout template?

9 comments:

micha said...

I assume you attended one of my talks about ICEfaces at Jazoon, right? If so... thanks for the feedback... :-)

Unknown said...

Salü Micha! Actually I attended both talks ;-) - great stuff, indeed!

basZero said...

I can only confirm that the ICEfaces architecture fully convinced me when I was at JavaOne... More to come from our side :-)

Tom Sawyer said...

Thanks for the great job posted here.

Have you ever tried DBUnit and MySQL in the application? please advise how to do it. According to my testing, MySQL cannot be configured in the Bootstrap and there is few info. in seam forum.

As for DBUnit, I use the DBUnit version 2.2 provided in seam examples, it does not work either: BinaryUri cannot be initiated.

Unknown said...

Is this a general problem with Seam (does it work with a seam-gen project) or just related to this setup? I haven't tried DBUnit so far, I usually run an in-memory HSQLDB in combination with import.sql.

For a general problem, the Seam forum might be the better place to ask.

Derrick said...

Hey all, I've tried running this and when I get to the mvn package step I get an error when building the webapp because of a failure to read an artifact descriptor due to an access denied to "http://repository.jboss.org/maven2/org/jboss/seam/embedded/hibernate-all/beta3.SP9/hibernate-all-beta3.SP9.pom". Any thoughts on how to resolve this problem? Also, can this be run with richfaces instead of icefaces?

Unknown said...

Hmm, this is quite an old version. We have switched to Seam 3 and JBoss Forge in the meantime.

Looking at the latest Seam 2.3 source, it seems to me that they have changed to Maven now. I'd recommend to checkout the examples - and copying one that fits your needs.

Also, the error you see is releated to the embedded JBoss for testing, which is now replaced with Arquillian:

https://docs.jboss.org/author/display/ARQ/Seam+2

Derrick said...

Hey Thomas,
Thanks for the quick reply. The reason I had those problems was because the library was deprecated and needed to be switched. However, I am running into 1 other issue. When the project is deploying an error is returned stating the following:

Running TestSuite
java.lang.RuntimeException: Could not create Component: org.jboss.seam.security.ruleBasedPermissionResolver
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1202)
at org.jboss.seam.init.Initialization.installComponents(Initialization.java:1118)
at org.jboss.seam.init.Initialization.init(Initialization.java:733)
at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:919)
at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
at mdh.AuthenticatorTest.startSeam(AuthenticatorTest.java:17)
Caused by: java.lang.IllegalArgumentException: No converter for type: org.drools.RuleBase
at org.jboss.seam.util.Conversions.getConverter(Conversions.java:63)
at org.jboss.seam.Component$ConstantInitialValue.<.init.>(Component.java:2481)
at org.jboss.seam.Component.getInitialValue(Component.java:538)
at org.jboss.seam.Component.getInitialValueHonoringExceptions(Component.java:512)
at org.jboss.seam.Component.initInitializers(Component.java:489)
at org.jboss.seam.Component.<.init.>(Component.java:254)
at org.jboss.seam.Component.<.init.>(Component.java:205)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1186)
... 27 more
Tests run: 7, Failures: 1, Errors: 0, Skipped: 6, Time elapsed: 9.969 sec <<< FAILURE!

Results :

Failed tests:
startSeam(mdh.AuthenticatorTest)

I saw a similar comment about this issue in the original post; however, they didn't provide instructions on a fix. Thoughts?

Also, please understand the reason I am still using this is because my project is strictly tied to Seam 2.2.1, Maven 3 and Jboss-as 5.1. So far, this has been the closest I have got to getting all three working together. Please email me a response at dsutherland1492@gmail.com if you could. Thanks for your help.

Unknown said...

Hi Derrick,

Looks like there is a problem with Drools. If you don't need the rule based security, I'd remove it. AFAIR the reference to Drools can be removed by just deleting the appropriate tag in components.xml.

BTW to your question in the first comment, the archetype uses RichFaces by default if you skip the icefaces parameter.