Project

General

Profile

Migration to glassfish v3 and JSF 2 - richfaces 4.

Eclipse projects

Each eclipse project must change its dependencies

Replace glassfish 2 dependencies to glassfish 3 dependencies

GlassFishLink -> GlassFish3Link
Glassfish 2 library -> Glassfish 3 library

In tests projects

add gf-client.jar dependency in all tests projects (do not forget "cicero tests").

Persistence API migration

All the persistence.xml files must rename their toplink reference to eclipselink. In the tests projects.

<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/imagedatabase" />
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="..." />
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
</properties>

Additionnaly, we have to add the persistence units in a project when dependencies need them. This means
to add a persitence unit for mrisessions in virtual_file_system_services_unit_tests, cicero_file_manage_system_website etc.

The query.getSingleResult() method from JPA now return an Object of property type instead of a Vector of Object.

Strange behavior

It seems that the acquisition of persistence context via the createEntityManagerFactory("pu") search for
the pu persistence unit in all the persistence.xml files of the path. And not only of the current project. And so it can use a persistence.xml file of an EJB project with JTA source.
To correct this we can change the persistence unit name in persistence.xml files of test projects and during the createEntityManagerFactory() call.

Organisation of EAR files

Glassfish 3 seems not to support lib files at root of the ear file.
And the interface JARs must also be in lib dir.
They need to be placed in lib/ folder.

for example cicero.ear

lib/cicero-library.jar
lib/data_transfer_interface.jar
data_transfer_services.jar

etc.

Organisation of the WAR file

The richfaces library have to be in WEB-INF/lib folder.

New libraries to perform a lookup

In glassfish v2.x, we used the appserv-rt.jar and javaee.jar libraries to perform a lookup. In glassfish v3.x, we need tu use gf-client.jar which import many others libraries (with MANIFEST file). This is impacting all tests projects.

Global JNDI names

In JavaEE6, global JNDI names are available to reference EJB.
For example:
Access to fr.cnrs.mri.service.virtualfileSystem.VirtualFileSystemService
become java:global/cicero/virtual_file_system_services/VirtualFileSystemBean

Migration to JSF 2.0

Some explanation resource:
http://www.laliluna.de/articles/posts/jsf-2-evaluation-test.html

First of all, It's necessary to upgrade eclipse to Helios in order to use Project Facets for jsf 2.0.

Add taglib headers or better use ui:composition tag

It is better to use the ui:composition tag which come from facelets lib, as a root tag.

<ui:composition xmlns="http://www.w3.org/1999/xhtml&quot;
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">

</ui:composition>

New organisation of resources

Two new jsf tags appears: <h:outputScript> and <h:outputStylesheet>. They need a resources folder (in WebContent). Inside it we can create folders (like css/, javascript/ etc.)
and these resources will be accessible by the attribute library of the new tags.
see http://www.ibm.com/developerworks/java/library/j-jsf2fu1/index.html

To include jQuery we can use inside the <h:head> tag, the
<rich:jQuery /> tag.