Glassfish and Seam Tips
The Seam forum regularly gets questions about Glassfish -- it is probably the third most popular platform for Seam apps behind JBoss AS and Tomcat. Here are some tips on how to make Seam apps work best on Glassfish.
1. Enable Seam logging in Glassfish: Seam uses log4j to log. Glassfish does not support log4j by default. You need to include a log4j.xml file in the JAR file for EJB3 beans (the myapp.jar file inside myapp.ear). For an example, check out the new examples/glassfish example in Seam 1.2 GA.
2. Must include the SeamELResolver: In order for Glassfish to resolve the Seam EL expressions correctly, you need to add an SeamELResolver to faces-config.xml.
-
<faces-config version="1.2"
-
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
-
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
-
-
<application>
-
<el-resolver>org.jboss.seam.jsf.SeamELResolver</el-resolver>
-
</application>
-
-
<!-- Select one of the standard transaction models for the Seam application -->^M
-
<lifecycle>
-
<phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
-
</lifecycle>
-
</faces-config>
If not, you will not be able to reference Seam built-in component using their shorthand names (e.g., #{conversationList} and #{identity} etc.). This is the cause of the issues discussed here and here in the forum.
3. No need for the el-*.jar: Since Glassfish already bundles JSF 1.2, there is no need to include the el-*.jar files in your EAR file and reference them in application.xml.
Let me know if you have more tips on how to get Glassfish and Seam work more smoothly together. ![]()
February 28th, 2007 at 3:35 pm
A recent doc change in Seam notes that selection of the JDK logger vs log4j is automagic. I haven’t followed this development, so I’m not sure if its a recent change or relevant to your first point.
http://fisheye.labs.jboss.com/browse/JBoss/jboss-seam/doc/reference/en/modules/concepts.xml?r1=1.52&r2=1.53
February 28th, 2007 at 3:44 pm
Thanks Marcus. I think that paragraph applies to loggers that you injected into your Seam application. Seam itself still uses Log4J to output its debug messages AFAIK.
March 1st, 2007 at 2:53 am
Naw, actually this has been true for a while: we automatically choose log4j vs jdk logging for all logging. I just forgot to update the docs….
May 22nd, 2007 at 9:19 am
Why not code against the SLF4J API so that SEAM, Hibernate & all is independent of the logging implementation (could be Log4j, Logback or JDK logger) ?
January 29th, 2008 at 8:17 pm
I wrote how to easily install Seam POJO apps on Glassfish here.
April 1st, 2008 at 6:33 pm
Hi Michael, I am constantly encountering ClassNotFoundException : org.jboss.seam.jsf.SeamELResolver
every time when I run Glassfish example
on page
http://www.coffeecrew.org/docs/html/netbeansFaceletsSeamEjb3/netbeansFaceletsSeamEjb3.html
. Would you mind to mail me , if you know the
cause of my error.
I properly added resolver in faces-config.xml,
also jboss-seam.jar is in my classpath.