Bug 1018956

Summary: Seam 2.2 Booking example migration incomplete
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Marek Schmidt <maschmid>
Component: DocumentationAssignee: sgilda
Status: CLOSED CURRENTRELEASE QA Contact: Russell Dickenson <rdickens>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.0   
Target Milestone: GA   
Target Release: EAP 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Build Name: 14877, Migration Guide-6.2-1 Build Date: 02-10-2013 13:32:44 Topic ID: 4958-460376 [Latest]
Last Closed: 2013-12-15 16:22:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Marek Schmidt 2013-10-14 19:11:28 UTC
Title: Migrate the Seam 2.2 Booking Example to JBoss EAP 6

Describe the issue:

The steps described in Migrate the Seam 2.2 Booking Example to JBoss EAP 6
 are incomplete and the result will not be a fully functional Booking example application.

Suggestions for improvement:

Missing steps are

* adding hibernate exclusions to jboss-dependency-structure.xml:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
  <deployment>
      <dependencies>
          <module name="javax.faces.api" slot="1.2" export="true"/>
          <module name="com.sun.jsf-impl" slot="1.2" export="true"/>
          <module name="org.apache.log4j" slot="main" export="true"/>
          <module name="org.slf4j" slot="main" export="true"/>
      </dependencies>
      <exclusions>
          <module name="org.hibernate" slot="main"/>
      </exclusions>
  </deployment>
  <sub-deployment name="jboss-seam-booking.war">
    <exclusions>
          <module name="javax.faces.api" slot="main"/>
          <module name="com.sun.jsf-impl" slot="main"/>
    </exclusions>
    <dependencies>
          <module name="javax.faces.api" slot="1.2"/>
          <module name="com.sun.jsf-impl" slot="1.2"/>
    </dependencies>
  </sub-deployment>
</jboss-deployment-structure>

* adding <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />  to the persistence.xml

* changing the default datasource JNDI to java:jboss/datasources/ExampleDS

Additional information:

(see also http://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/6.2/html/Migration_Guide/sect-Migrate_Seam_2.2_Applications.html )

Comment 1 sgilda 2013-10-15 19:33:49 UTC
Fixed topic 4598. There is an odd issue where the title property is set to 'Start JBoss Enterprise Application Platform 6' and it replaced the valid 'Migrate the Seam 2.2 Booking Example to JBoss EAP 6' title in the XML. I need to fix that but am waiting for someone to take a look at it.

Comment 2 sgilda 2013-10-15 19:43:37 UTC
Fixed topic 4598.

Comment 4 sgilda 2013-10-17 15:09:37 UTC
Updated the wrong topic! Fixed topic 4958, rev. 547472.

Comment 6 Marek Schmidt 2013-10-29 13:52:39 UTC
There are few additional details:

1. In the jboss-deployment-structure.xml listing, the subdeployment name is corrupted
<sub-deployment name="jboss-web-booking-web.war"

it should be

 <sub-deployment name="jboss-seam-booking.war">


2. in "3. Copy JARs from the Seam 2.2 distribution", the list of jars is incomplete. the antlr.jar is missing in the list, the full list should be:

antlr.jar
slf4j-api.jar 
slf4j-log4j12.jar 
hibernate-core.jar 
hibernate-entitymanager.jar 
hibernate-validator.jar 
hibernate-annotations.jar 
hibernate-commons-annotations.jar


3. The "4. Change the JNDI lookup names" 

The guide is correct in that one should look for what JNDI names are displayed in the EAP log, however, they don't match the actual ones. (basically the guide expects the EAR to be called "seam-booking.ear" with "booking-ejb.jar" EJB jar, which might be true for Seam 2.3, while in Seam2.2 in EAP5 the archive is named jboss-seam-booking.ear with jboss-seam-booking.ejb, so the JNDI will be different

(although the names may still depend on whether one uses exploded or ordinary archives, but this guide doesn't talk about exploded archives)

So the text of this section should instead be the following: 

"""
Change the JNDI lookup names
Change JNDI lookup strings in the jboss-seam-booking.war/WEB-INF/components.xml file. Because of new JNDI portable rules, JBoss EAP 6 now binds EJBs using JNDI portable syntax rules and you cannot use the single jndiPattern that was used in JBoss EAP 5. This is what the application EJB JNDI lookup strings must be changed to JBoss EAP 6: 

java:global/jboss-seam-booking/jboss-seam-booking/HotelSearchingAction!org.jboss.seam.example.booking.HotelSearching
java:app/jboss-seam-booking/HotelSearchingAction!org.jboss.seam.example.booking.HotelSearching
java:module/HotelSearchingAction!org.jboss.seam.example.booking.HotelSearching
java:global/jboss-seam-booking/jboss-seam-booking/HotelSearchingAction
java:app/jboss-seam-booking/HotelSearchingAction
java:module/HotelSearchingAction

The JNDI lookup strings for the Seam 2.2 framework EJBs must be changed as follows:

java:global/jboss-seam-booking/jboss-seam/EjbSynchronizations!org.jboss.seam.transaction.LocalEjbSynchronizations
java:app/jboss-seam/EjbSynchronizations!org.jboss.seam.transaction.LocalEjbSynchronizations
java:module/EjbSynchronizations!org.jboss.seam.transaction.LocalEjbSynchronizations
java:global/jboss-seam-booking/jboss-seam/EjbSynchronizations
java:app/jboss-seam/EjbSynchronizations
java:module/EjbSynchronizations

You can take either of the following approaches:

 a. Add component elements
    You can add a jndi-name for every EJB to the WEB-INF/components.xml:

    <component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
    <component class="org.jboss.seam.async.TimerServiceDispatcher" jndi-name="java:app/jboss-seam/TimerServiceDispatcher"/>
    <component class="org.jboss.seam.example.booking.AuthenticatorAction" jndi-name="java:app/jboss-seam-booking/AuthenticatorAction" />
    <component class="org.jboss.seam.example.booking.BookingListAction"  jndi-name="java:app/jboss-seam-booking/BookingListAction" />
    <component class="org.jboss.seam.example.booking.RegisterAction" jndi-name="java:app/jboss-seam-booking/RegisterAction" />
    <component class="org.jboss.seam.example.booking.HotelSearchingAction" jndi-name="java:app/jboss-seam-booking/HotelSearchingAction" />
    <component class="org.jboss.seam.example.booking.HotelBookingAction" jndi-name="java:app/jboss-seam-booking/HotelBookingAction" />
    <component class="org.jboss.seam.example.booking.ChangePasswordAction" jndi-name="java:app/jboss-seam-booking/ChangePasswordAction" />

 b. You can modify the code by adding the @JNDIName(value="") annotation specifying the JNDI path. An example of the changed stateless session bean code is below. A detailed description of this process can be found in the Seam 2.2 reference documentation.

@Stateless
@Name("authenticator")
@JndiName(value="java:app/jboss-seam-booking/AuthenticatorAction")
public class AuthenticatorAction 
    implements Authenticator
{
...
}


"""

Comment 7 sgilda 2013-10-29 14:11:48 UTC
Thanks again Marek. Updated topic 4958.

Comment 9 Marek Schmidt 2013-11-18 15:19:24 UTC
Verified on EAP 6.2.0.CR2 preview.