Sunday, 27 January 2008

Why I ditched Seam 2

I recently started using Seam to help develop a web application running under Weblogic. In the end I ended up ditching it and going with myfaces JSF.

Reasons for ditching Seam included:

I was not using EJB3 so did not benefit from the tight integration between JSF and EJB programming models.

There were 2 files controlling navigation faces-config.xml (myfaces) and pages.xml (Seam) which seemed a little confusing. I think in practice you should keep the faces-config.xml pretty empty and just use the Seam pages.xml.

Seam 2 does not run under jetty as there is an EL library mismatch.

The test framework is great if you use test NG. If you have to use JUnit, then you need to port the test ng classes to use junit 4 annotations and then try and get the test framework / Seam to bootstrap itself which seems to involve getting an embeddable EJB runtime up and running as Seam uses Stateful session beans to help support its conversational state.

When plugging in a custom JAAS module The security mechanism employed by Seam led me to believe it might plugin nicely with JAAS, but reports on the web led me to believe getting this to work with a Weblogic JAAS module might not work.


I did have to spend time producing maven pom to get it to build under maven too. This is documented here
so did not take too long, just another thing to consider.

The support on the Seam forum was not great. I posted a couple of questions and got no response. My feeling towards open source is that I know people do it for free but if they are actively going to encourage people to use their frameworks then they should support them properly.

I am not saying Seam is bad at all, but I was not getting much benefit from using it over JSF apart from a couple of nice annotations.

Friday, 25 January 2008

JPA Mapping Tips

Personally I prefer the annotations on the fields as it makes it easy to locate the annotation and change it.

JPA Tips

Interestingly (or not as the case may be), how the JPA implementation decides whether to look for a annotation on a method or a field is how you annotate the @Id. If the id is annotated on the field, then the JPA implementation expects to find the rest of the annotations on the fields. This is interesting because if you have a class with two attributes and you choose (for some bizarre reason) to put the annotation for field a on the attribute and for field b on the method, then chances are your annotation for field b will be ignored. (Well it will be if you are using Hibernate as your provider at least).

Maven dependency browser

Dependency Browser

Free maven book

Better builds with maven

Infrastructure software

Maven repository Artifactory
Continous integration server Bamboo
Bug tracking Bug tracking
View Source Repository Fisheye

Switch off javascript in myfaces

In web.xml setup a context-param section and setup parameter name:


Useful maven commands

To download source code into your maven repo:

mvn eclipse:clean eclipse:eclipse –DdownloadSources=true

Another example:

mvn -r -N -U -cpu -fae clean install

-r Execute goals found in the reactor (the reactor is a maven feature whereby maven decides what to build first based on the dependency graph)
-N Do not recurse into sub-projects
-U Update snapshots
-cpu Check plugin updates
-fae Fail at end (ie. keep building if one module or test fails)

Wednesday, 23 January 2008

Remote Debugging with Weblogic 9

Go to your weblogic domain.

Edit file setDomainEnv.cmd inside the bin directory within your domain.

Go to line 80 and type:

set debugFlag=true

Start weblogic and connect to default port 8453 (which is specified in setDomainEnv.cmd if you need to change it).

Remote Debugging with Maven 2

set MAVEN_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8008,server=y,suspend=y