Why updating?
- Version 4.2 fixes some bugs which were affecting our application.
- Red Hat announced they are going to use 4.2 in their Enterprise Application Platform, so they are committed to support this version for a long time.
- I had already updated some libraries of JBoss 4.05 to use some features we where needing; the new version comes with the same updated libraries so I think they will be better compatible than my souped-up, unsupported version.
The application to migrate is a JavaEE web application, developed in Eclipse and using these technologies:
- Seam 1.2.1 is the integrating framework.
- Faceletes for page design
- Hibernate 3.2 : core, search, annotations and entitymanager.
- Lucene 2.2 for fast full-text searching: both using hibernate search and custom code.
- JTDS as JDBC driver.
- SQL Server 2000 as Database on a windows server
- Fedora linux 6 for the webserver.
- "some" JSF implementation...
- keep the myfaces JSF implementation.
- update to Sun's RI JSF implementation.
So now we can begin our
Migration checklist to JBoss 4.2.1 and Sun's JSF
from Jboss 4.0.5 and myfaces.
and add this one instead:<module>
<java>el-api.jar</java>
</module>
<module>
<java>el-ri.jar</java>
</module>
You will need to remove and add the relative jars to the root of your ear. The commons-collections-3.1 is needed by Ajax4jsf; Jboss ships now with a different version.<module>
<java>commons-collections-3.1.jar</java>
</module>
In faces-config.xml add
<application>and update the headers to:
<el-resolver>org.jboss.seam.jsf.SeamELResolver</el-resolver>
<message-bundle>messages</message-bundle>
</application>
<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">
In web.xml remove this listener:
org.apache.myfaces.webapp.StartupServletContextListenerand all other references to myface's classes. No new listener should be needed.
When using tomahawk you may like to keep some org.apache.myfaces context parameters, as it should work on Sun's RI but uses the parameters named in myface's style.You may like to update the header of jboss-app.xml:
<?xml version="1.0" encoding="UTF-8"?>Problems & some fixes
<!DOCTYPE jboss-app
PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
Content-Type
Using myfaces the rendered pages have "Content-Type: text/html;" as reported by Firefox's plugin "web developer", using Sun's RI the content type is now "Content-Type: application/xhtml+xml;".Technically the second one should be better, as discussed by here, but it brings some issues:
- Even with same HTML and CSS the pages could look-like different.
- Internet explorer (upto 6) doesn't like "xhtml+xml"
- Some redirects won't work.
<f:view contentType="text/html"...Still this leaves a problem with Seam's PDF rendering: there's no way to modify the content type of the redirect servlet that brings you from the page to the pdf download link, I'm going to see if I can get apache to force the "correct" contentType served to clients.