Reposting my Seam 2 blog here too as it could be spread to more audience Seam 2.3.1.Final released!

 

Who is not familiar with jboss.org Maven repository here are Seam 2.3.1.Final artifacts https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss.seam~~2.3.1.Final~~

More than a year after 2.3.0.Final release, next version of Seam 2.3 is out! This release is only about bug fixing. We fixed 58 issues and got pretty stable version.

 

Download links are as usual on sourceforge.net at http://sourceforge.net/projects/jboss/files/JBoss%20Seam/2.3.1.CR1/

or at http://seamframework.org/Seam2/Downloads

 

Documentation uploaded and ready at http://docs.jboss.org/seam/2.3.1.CR1/reference/html/

 

What is more related Maven artifacts are available at JBoss Maven repository - look at https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss.seam~~2.3.1.CR1~~  if you need to get correct GAV coordinates.

 

Enjoy it and if you find out any issues don't hesitate to report them in https://issues.jboss.org/browse/JBSEAM project through our simplified JIRA form like I announced at https://community.jboss.org/thread/228732

We finally kicked out the 2.3.0.Final release!

Check the http://www.seamframework.org/Seam2/Downloads or just use it with Maven after updating jboss-seam version to 2.3.0.Final in your application's pom.xml - the link shows all released artifacts https://repository.jboss.org/nexus/index.html#nexus-search;gav~org.jboss.seam~~2.3.0.Final~~

 

Almost everything was alredy written in my announcement  Seam 2.3.0.CR1 is out! and I would like to thank Marek Schmidt, Tomas Remes, Dan Hinojosa, Brian Leathem, Shane Bryzak, Jason Porter and Rafael Benevides for their contributions to 2.3.0 release.  

 

Just to be clear for everybody what is SEAM 2.3 and what is not.

 

  • Seam 2.3.0 is as a middle step for Seam 2.2 on JBoss AS5 to full Java EE 6 (JBoss AS7)
  • Seam 2.3 is a short-time target for existing apps like 2-3 years time frame (don't take my guess as an exact time plan)
  • The future development plan should consider more CDI with Java EE 6.
  • Seam 2.3 continues using the Seam 2 dependency injection implementation and IT IS NOT integrated with CDI technology
  • Seam 2.3 works with JSF2, JPA2, Bean Validation 1.0, EJB3.1.

 

So we will fix bugs and release new versions for Seam 2 line until replacement will be ready.

 

I hope you will try it and enjoy it

 

PS. Report any issues you have discovered, we always appreacite this community help.

Seam 2 is very close to finish our 2.3.0 path. Today Seam 2.3.0.CR1 was released! We still have to polish Seam reference documentation and fix a few issues for doing final release of 2.3.0.

 

Anyway there is a big progress in comparing to 2.3.0.Beta2 milestone. We have got now working JUnit Arquillian integration testsuite instead of using legacy JBoss Embedded with TestNG framework, and even Seam 2 framework is not full Java EE 6 framework, as it was originally based on Java EE 5 set of technologies, we tries to come near to AS 7 runtime and support major technology upgrade like JSF 2, JPA2 and EJB 3.1.

 

Seam-gen was updated too and even it is not so powerfull like before it can provide basic project scaffold of ant based project. We won't  invest more time to refactoring seam-gen to produce Maven based project skeleton. Latest JBoss Tools recognizes Seam 2.3 as a runtime and can be used for development in old way as before.

 

Next we polished a little Seam 2.3 Maven modules and give users Seam BOM file, which declares all required dependencies  working with the release and uses also Java EE 6 BOM file with Hibernate. Seam examples bundled in distribution represents its usage.

 

Download links are at https://sourceforge.net/projects/jboss/files/JBoss%20Seam/2.3.0.CR1 and of course published at http://www.seamframework.org/Seam2/Downloads. Documentation was updated too even we will work on it untill final release goes out. Summary of available documentation formats are at http://www.seamframework.org/Seam2/Seam2Documentation.

 

 

How to start with using Seam 2.3.0.CR1?

 

  • First set up the JBoss repository in your ~/.m2/settings.xml like profile (you can use a template from Seam2.3 build/settings.xml ):


<profile>       
       <id>jboss-public-repository</id>
       <repositories>
         <repository>
           <id>jboss-public-repository-group</id>
           <name>JBoss Public Maven Repository Group</name>
           <url>https://repository.jboss.org/nexus/content/groups/public/</url>
           <layout>default</layout>
         </repository>
        ...       
       </repositories>
 </profile>
 ... 

<activeProfiles>
     <activeProfile>jboss-public-repository</activeProfile>
</activeProfile>

 

 

  • Update your application project with the following example of usage Seam BOM and then jboss-seam and jboss-seam-ui modules for instance :

 

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.seam</groupId>
                <artifactId>bom</artifactId>
                <version>2.3.0.CR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            ...
     </dependencies>
</dependencyManagement>

<dependencies>

   <dependency>
      <groupId>org.jboss.seam</groupId>
      <artifactId>jboss-seam</artifactId>
      <type>ejb</type>
   </dependency>

   <dependency>
      <groupId>org.jboss.seam</groupId>
      <artifactId>jboss-seam-ui</artifactId>      
   </dependency> 
   ...
</dependencies>
Marek Novotny

Seam 2.3.0.Beta2 is out

Posted by Marek Novotny May 23, 2012

After 2.3.0.Beta1 release we released second beta.

 

Big thanks goes to Marek Schmidt author of Arquillian Integration, Dan Hinojosa who helped with seam-gen and examples migrations and Shane Bryzak who helped with fixing of bugs.

 

What is new?

 

Arquillian integration replaced deprecated JBoss Embedded. We also updated Seam-gen to be able to work (there are still issues, but it works at least with some workarounds) and further worked with JBoss Tools team to have that update in JBoss Tools eclipse plugin 3.3.

 

We added Seam BOM file which manages all versions of Seam 2.3 modules and other dependencies used and relied on in integrations with other frameworks or libraries.

 

Maven artifacts are published in JBoss Nexus repository. So update version in your application's pom.xml files or download the distribution from link above.

 

  • Set up the JBoss repository in your ~/.m2/settings.xml like profile (you can use a template from Seam2.3 build/settings.xml )
  • Correct Maven usage is for instance like with help of imported Seam BOM:
...
<dependencyManagement>
   <dependencies>
      <dependency>
         <groupId>org.jboss.seam</groupId>
         <artifactId>bom</artifactId>
    <version>2.3.0.Beta2</version>
         <type>pom</type>
         <scope>import</scope>
      </dependency>
 </dependencies>
</dependencyManagement>


<dependencies>
   <dependency>
     <groupId>org.jboss.seam</groupId>
     <artifactId>jboss-seam</artifactId>
     <type>ejb</type>
   </dependency>
   <dependency>
     <groupId>org.jboss.seam</groupId>
     <artifactId>jboss-seam-ui</artifactId>
   </dependency>
</dependencies>
...

 

Seam 2.3.0.Beta2 also uses Richfaces 4.2.2.Final CDK for generation of Seam UI taglib, so we are not using old Richfaces 3 CDK anymore. There are some minor issues with that migration, as you could see in JBSEAM-4955 . However it is not blocking usage of Seam Validators or Converters.

 

Download links are at http://www.seamframework.org/Seam2/Downloads and Documentation links are at http://www.seamframework.org/Seam2/Seam2Documentation.

 

We change a little content of distribution to have source distribution besides  binary distribution with seam-gen. Examples which should work out of the box are in src zip in examples-ee6 subdirectory

 

Our roadmap is now updated to have 2.3.0.CR1l, which should fix all known and not yet discovered issues in proper timeframe and will become our 2.3.0.Final.

 

So check it out Seam 2.3.0.Beta2 and return back with a feedback!

Seam 2 reached one of milestone in 2.3.0 roadmap - 2.3.0.Beta1 release. We plan to do another 2.3.0.Beta2 release this month to finish Arquillian and Seam Gen features. After that we will focus on fixing all bugs/issues to finish the 2.3.0 roadmap.

 

I tried to avoid 1st April announcement ;-), even we practically released that in the end of March. Download links are at http://www.seamframework.org/Seam2/Downloads and Documentation links at http://www.seamframework.org/Seam2/Seam2Documentation. I hope this release will be consumed much more in Maven projects than to download the compressed distribution archive.

 

After 2.3.0.Alpha release in October last year, this Seam 2 milestone - 2.3.0.Beta1 is breaking things and surfs on JBoss AS 7 wave of releases, because it adds a few Java EE 6 technologies into Seam 2 framework, which was originally based on Java EE 5 set of technologies, and tries to come near to AS 7 runtime.

 

As one of big changes is long awaiting JSF 2 support instead of JSF 1.2. This goes hand in hand with Bean Validation support and finally with JPA 2 and Hibernate 4 family upgrade in Seam 2.

 

We also did some steps to replace JBoss Embedded runtime with Arquillian while it still uses old mocking environment for the whole integration testsuite.

 

We migrated a few examples like Booking, UI, Mail, Todo to be ready to run with native Java EE 6 technologies on AS 7. More examples will come in later releases.

 

There are still some work to do before final release will be out. But we have now a checkpoint.

 

I am excited and hope that you will try it and return back with a response. WE NEED a response from community!

 

Usage of Seam 2.3.0.Beta1 Maven artifacts from JBoss Nexus repository is the following.

 

  • Set up the JBoss repository in your ~/.m2/settings.xml like profile (you can use a template from Seam2.3 build/settings.xml ):

 

<profile>
      <id>jboss-public-repository</id>
      <repositories>
        <repository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Maven Repository Group</name>
          <url>https://repository.jboss.org/nexus/content/groups/public/</url>
          <layout>default</layout>
        </repository>
       ...
      </repositories>
</profile>
 ...
<activeProfiles>
    <activeProfile>jboss-public-repository</activeProfile>
</activeProfile>

 

  • Update your application project with correct version for instance like:

 

<dependency>
     <groupId>org.jboss.seam</groupId>
     <artifactId>jboss-seam</artifactId>
     <type>ejb</type>
     <version>2.3.0.Beta1</version>
</dependency>

<dependency>
     <groupId>org.jboss.seam</groupId>
     <artifactId>jboss-seam-ui</artifactId>
     <version>2.3.0.Beta1</version>
</dependency>

Today I will guide you through migration path for Dvdstore example from Seam 2.2.2.Final distribution.

What is interesting on Dvdstore example? It presents quite complex set of Seam features including jbpm-jpdl and Hibernate Search integration.

Data source preparation

If you don't want to use default ExampleDS and change JNDI in persistence.xml, you have to create the new data source under JNDI java:/dvdstoreDatasource.

Simply run:

bin/jboss-admin.sh -c \
--command="add-data-source --jndi-name=java:/dvdstoreDatasource --connection-url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 --username=sa --password=sa --pool-name=DefaultDS_pool --driver-name=h2"

 

In comparing to JBoss AS 7.0.2.Final, if you use 7.1.0.x you need to do additional step to enable data source, because it is created disabled:

bin/jboss-admin.sh -c --command="/subsystem=datasources/data-source="java\:\/dvdstoreDatasource":enable"

You can check the creation of datasource in server log or on console:

INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) Bound data source [java:/dvdstoreDatasource]

Enterprise package migration - dvdstore EAR

Main target of EAR configuration is to set up correctly supported runtime libraries - these are JSF 1.2, Hibernate JPA. Seam 2.2.2.Final has got integration with JSF 1.2, JPA 1.0. On the other side JBoss AS7 has got JSF 2.1 and JPA 2.0 by default. These specifications are not drop in replacements and therefore dvdstore configurations require some changes to disable defaults and enable supported Seam application. This type of configurations can be managed in more than one way.

I will show you the powerful way - which are placed in jboss-deployment-structure.xml file. This is not new, you already could see it in my previous blogs about Booking nad JPA examples migrations. But now jboss-deployment-structure.xml file have one extra sub-deployment element section in comparison to Booking jboss-deployment-structure.xml file.

Insert the following content to jboss-seam-dvdstore.ear/META-INF/jboss-deployment-structure.xml:

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

 

Little explanation to all lines above:

  1. Deployment element disables default JPA 2 provider in main slot (see exclusion of org.hibernate), because we won't use default Hibernate from AS7, but bundled Hibernate 3.3.1 in application lib directory.
  2. Deployment element for EAR also turns on all necessary dependencies and JSF 1.2 support. Notice additional attribute export, which says that a module be available also for WAR(s) and JAR(s).
  3. Sub-deployment for WAR jboss-seam-dvdstore.war disables default JSF 2 and choosed JSF 1.2 alternative and again disabling Hibernate 4 slot.
  4. Sub-deployment for EJB jar jboss-seam-dvdstore.jar disables  default main Hibernate 4 slot too.

Final step is to add all required additional jars for using known supported integraitons with Seam 2.2 It means bundling hibernate jars from Seam 2.2.2.Final distribution and its direct runtime dependencies:

  • hibernate-core.jar
  • hibernate-validator.jar
  • hibernate-entitymanager.jar
  • bsh.jar
  • hibernate-annotations.jar
  • antlr.jar

EJB archive migration - JAR

Main point of the following steps are to be properly bundled Hibernate 3 libraries and usage of dependencies which are originally integrated with Seam.

Main points of using JPA provider in AS7 are covered in https://docs.jboss.org/author/display/AS7/JPA+Reference+Guide in section "Packaging the Hibernate 3.5 or greater 3.x JPA persistence provider with your application". But there are some limitations of hibernate integration older than 3.5 version.

For instance import/export database schema with bundled Hibernate 3.3.x doesn't work out of the box - it requires additional class mapping. Next change is caused by switching of default database driver for data source from HSQLDB to H2 database and little incompatibility changes in Varchar support. This requires a small change in com.jboss.dvd.seam.Product class to extends length of description field to e.g 9000. Because otherwise you will see exceptions like this:

Caused by: org.h2.jdbc.JdbcSQLException: Value too long for column "DESCRIPTION VARCHAR(1024)"

Changes in jboss-seam-dvdstore.jar/META-INF/persistence.xml are following:

  • We need to choose proper JPA provider for bundled Hibernate 3.3 library:

    <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled" />

  • Adding mapping for entity classes due not possibility to automatically entities scan for bundled Hibernate 3.3:

<class>com.jboss.dvd.seam.Actor</class>

<class>com.jboss.dvd.seam.Admin</class>

<class>com.jboss.dvd.seam.Category</class>

<class>com.jboss.dvd.seam.Customer</class>

<class>com.jboss.dvd.seam.Inventory</class>

<class>com.jboss.dvd.seam.Order</class>

<class>com.jboss.dvd.seam.OrderLine</class>

<class>com.jboss.dvd.seam.Product</class>

<class>com.jboss.dvd.seam.Product</class>

<class>com.jboss.dvd.seam.User</class>

  • We also need to change value of transaction.manager_lookup_class property to org.jboss.as.jpa.hibernate3.JBossAppServerJtaPlatform in hibernate.cfg.xml. This file is required for JBPM-JPDL database configuration for business process mapping.
<property name="transaction.manager_lookup_class" value="org.jboss.as.jpa.hibernate3.JBossAppServerJtaPlatform" />
  • Last step in EJB jar migration is, we need all xml file originally placed at EAR root to be moved into EJB jar root:
    • checkout.jpdl.xml,
    • jbpm.cfg.xml,
    • hibernate.cfg.xml,
    • newuser.jpdl.xml,
    • ordermanagement1.jpdl.xml,
    • ordermanagement2.jpdl.xml,
    • ordermanagement3.jpdl.xml.

Reason for that moving files is that EAR root directory is not in classloader path anymore n JBoss AS7.

Web application packaging in WAR

Configuration in jboss-seam-dvdstore.war should be changed in way of customizing  new format of JNDI to EJBs, first adding two lines for Seam EJBs EjbSynchronizations and TimerServiceDispatcher, second set all other dvdstore application based EJBs to JNDI pattern - this is the same as before, you need only change the JNDI pattern in jboss-seam-dvdstore.war/WEB-INF/components.xml from

<core:init debug="true" jndi-pattern="jboss-seam-dvdstore/#{ejbName}/local"/>

to

<core:init debug="true" jndi-pattern="java:app/jboss-seam-dvdstore.jar/#{ejbName}"/>

 

I will use this way, because it is proper for dvdstore application with many application session beans. So at the end of this change, you will have jboss-seam-dvdstore.war/WEB-INF/components.xml with these additional 2 lines under already existing <core:init/> line:

 

<core:init debug="true" jndi-pattern="java:app/jboss-seam-dvdstore.jar/#{ejbName}"/>
<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"/>

 

And that is all! Enjoy shopping of DVDs in JBoss AS7.

Marek Novotny

Focus on Seam 2.3.0

Posted by Marek Novotny Dec 4, 2011

Public probably noticed that Shane Bryzak (Seam3 project lead) published blog about Seam.Next transformation. This is Seam team reaction to  SoWhatsHappeningWithSeam blog responses.

 

While Seam core team is focusing on Seam.Next transformation I am still slowly progressing with Seam 2.3.0.Beta1. This is not changing!

 

So I would like to write about Seam 2.3.0 in development.

 

First of all JSF2 support, this is primary reason to do 2.3.0 release. Although it is late and still not fully finished, 2.3.0.Beta1 will be very soon on table. Right now you can try current 2.3.0-SNAPSHOT from JBoss snapshot Maven repository (https://repository.jboss.org/nexus/content/repositories/snapshots/) and report all issue you have with them.

 

Just use Seam maven artifacts in your project:

 

<dependency>

     <groupId>org.jboss.seam</groupId>

     <artifactId>jboss-seam-ui-jsf2</artifactId>

     <version>2.3.0-SNAPSHOT</version>

</dependency>

 

<dependency>

     <groupId>org.jboss.seam</groupId>

     <artifactId>jboss-seam-debug-jsf2</artifactId>

     <version>2.3.0-SNAPSHOT</version>

</dependency>

 

You can also see CI results on Jenkins which does deploying of snapshots to above mentioned repository.

 

I ask myself regularly if Seam community appreciates keeping old JSF 1.2 integration in Seam if there will be support of JSF 2 included. Could you help me with the answer?

 

Second target for 2.3.0 is a support of JBoss AS7 and enjoying speed and modularity of new JBoss AS 7 runtime. I think this is interesting also like JSF2 support, but it raises some tasks which weren't originally planned for 2.3.0 and hinders finishing of 2.3.0. It is connected with upgrade of Hibernate Core, Search and JBPM3 integration for top level view and also replacing of Seam integration testsuite which is based on very old JBoss Embedded beta3. I will defer some of that tasks to later beta2 or 2.4.

 

I hope that with regarding to all responses in forums, Seam community would like primary to have done JSF2 support and all other tasks are for now on other side of our/my focus. If you have different opinion(s), raise your hands and shout loudly ;-).

I am proud to announce Seam 2.3.0.ALPHA release, which is the first release after migration to Maven multimodule project structure.

Although there are still few things to do in this migration like handling seam-gen and Wiki example, major things are now done.

 

Some noticed my 2 blog posts about Migration of JPA and Booking examples for JBoss AS7 deployment - they are also available

in 2.3.0.ALPHA sources and they can be built and deployed into AS7 if you use Maven profile jbossas7 in the examples.

 

Distribution is available at sourceforge.net and Release Notes are here. Documentation is uploaded at docs.jboss.org.

 

Next step in 2.3.0 development will be 2.3.0.Beta1, where is planned to have full support of JSF2 and bringing Arquillian power into Seam 2 project along legacy JBoss Embedded.

 

Stay tuned and if you want to contribute, contact me on my email hotmana76 at gmail.com or on #seam-dev channel on Freenode IRC.

This time I would like to guide you through migration of Seam Booking example which is Enterprise application - EAR.

 

Seam EAR migration is a little complicated in comparing to Seam JPA example. But what we have learnt from JPA example migration, we can use also in this EAR migration.

 

Basic overview of migration steps:

  1. Initialization of JSF 1.2 instead of default JSF 2,

  2. Bundling older hibernate jars than what are provided in JBoss AS7 by default,

  3. Changes in JNDI bindings  due new Java EE 6 JNDI portable syntax. (Note: there is a little mistake in that tutorial - see JAVAEETUTORIAL-44

 

First 2 steps we've done already in JPA example migration, but third step is new one because of using EJBs in EAR.

 

So let's start:

 

  1. Add new file jboss-deployment-structure.xml with the following content into jboss-seam-booking.ear/META-INF/:

    <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
      <deployment>
            <dependencies>
              <module name="org.apache.log4j" export="true"/>
              <module name="org.dom4j" export="true"/>
              <module name="org.apache.commons.logging" export="true"/>
              <module name="org.apache.commons.collections" export="true"/>
              <module name="javax.faces.api" slot="1.2" export="true"/>
              <module name="com.sun.jsf-impl" slot="1.2" export="true"/>
            </dependencies>
      </deployment>
      <sub-deployment name="booking-web.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>
    

     

  2. Next remove/comment hibernate property for cache provider class in jboss-seam-booking.jar/META-INF/persistence.xml:

    <!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> -->
    

     

  3. Add the following dependencies from seam distribution (seam/lib directory) into jboss-seam-booking.ear/lib directory, which are in JBoss AS 5/6 in different versions:

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

     

  4. Next we need to change JNDI lookup strings in jboss-seam-booking.war/WEB--INF/components.xml. Because of new JNDI portable rules, AS7 now binds EJBs with JNDI portable rules like for instance:

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

and for Seam framework EJBs like for instance:

java:global/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/seam-booking/jboss-seam/EjbSynchronizations
java:app/jboss-seam/EjbSynchronizations
java:module/EjbSynchronizations

Notice difference between java:app/jboss-seam/EjbSynchronizations and java:app/booking-ejb/HotelSearchingAction.

We can't use the single jndiPattern like we did before in JBoss AS 5/6. So there are a few solutions to do it, I chose adding jndi-name for every EJB into 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/booking-ejb/AuthenticatorAction" />
<component class="org.jboss.seam.example.booking.BookingListAction"  jndi-name="java:app/booking-ejb/BookingListAction" />
<component class="org.jboss.seam.example.booking.RegisterAction" jndi-name="java:app/booking-ejb/RegisterAction" />
<component class="org.jboss.seam.example.booking.HotelSearchingAction" jndi-name="java:app/booking-ejb/HotelSearchingAction" />
<component class="org.jboss.seam.example.booking.HotelBookingAction" jndi-name="java:app/booking-ejb/HotelBookingAction" />
<component class="org.jboss.seam.example.booking.ChangePasswordAction" jndi-name="java:app/booking-ejb/ChangePasswordAction" />

You can alternatively add @JNDIName(value="") annotation with JNDI path. Example of changed SLSB is below, look at @JndiName annotation, detailed description is at Seam2 reference documentation:

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

 

That is all in Booking example modifications.

 

Unfortunatelly the example how is done will deploy with error in JSF initialization.

 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/seam-booking]] (MSC service thread 1-1) Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! org.jboss.seam.jsf.SeamApplicationFactory
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:215) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:196) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
        at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.Final.jar:7.0.0.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
        at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
        at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
Caused by: java.lang.InstantiationException: org.jboss.seam.jsf.SeamApplicationFactory
        at java.lang.Class.newInstance0(Class.java:340) [:1.6.0_26]
        at java.lang.Class.newInstance(Class.java:308) [:1.6.0_26]
        at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:537) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:405) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        at javax.faces.FactoryFinder.access$400(FactoryFinder.java:135) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:717) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:239) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:186) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:131) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:205) [jsf-impl-1.2_13.jar:1.2_13-b01-FCS]

 

This is a bug in AS 7 Final. But I don't write this blog if there is not a way how to work around it ;-).

I discussed the issue with AS 7 developers and they fixed it in upstream sources.

So we need to download AS7 snapshot or build AS 7 from git sources. The easier is to get working binaries at latest JBoss AS7 snapshot

 

And that is realy all!

 

I am just succesfully customized Seam 2 JPA example to deploy and run on JBoss AS 7 server, so I will share steps which are required to do for that.

 

First JBoss AS 7 is great in start up time, deployment time, classloading isolation and much more. See JBoss AS7 page for more and detailed description!

 

Just quick info - Seam 2 JPA example is demonstrating JPA 1 usage, it uses JSF 1.2 and Richfaces 3.3.3.Final. Thanks to great classloading isolation Seam 2 can live and works just fine in JBoss AS7 although it is primarily targeted for Java EE 6, where are JSF2, JPA 2.

 

First step in customizing the example is set up of datasource. JBoss AS 7 release is changing the name of default datasource, which is for demos/examples. Now the default datasource is called java:jboss/datasources/ExampleDS, you have to just change the referenced datasource JNDI in the example or create new datasource with old name java:/DefaultDS.

 

I created new datasource with old name, because I am using many old examples and I don't want to change them all. New datasource is basically a clone of existing ExampleDS.

 

Start Jboss AS7 standalone instance by writing in terminal:

<installed_path_to_jbossas7>/bin/standalone.sh(on linux)
<installed_path_to_jbossas7>/bin/standalone.bat(on windows)

In another terminal window start CLI admin interface by:

<installed_path_to_jbossas7>/bin/jboss-admin.sh --connect(on linux)
<installed_path_to_jbossas7>/bin/jboss-admin.bat --connect(on windows)

Then write the command for creating actual datasource:

add-data-source --jndi-name=java:/DefaultDS --connection-url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 --username=sa --password=sa --pool-name=DefaultDS_pool --driver-name=h2

 

The above command is self describing ;-).

 

Now a few customizations which are done in jboss-seam-jpa.war:

  1. Remove jboss-web.xml from jboss-seam-jpa.war/WEB-INF/ - defined class loading in jboss-web.xml is now default behaviour.

  2. Comment or remove hibernate property

    <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>

    in jboss-seam-jpa.war/WEB-INF/classes/META-INF/persistence.xml

     

  3. Add the following dependencies from seam distribution (seam/lib directory) into jboss-seam-jpa.war/WEB-INF/lib directory, which are in JBoss AS 5/6 in different versions:
    slf4j-api.jar
    slf4j-log4j12.jar

    hibernate-core.jar
    hibernate-entitymanager.jar
    hibernate-validator.jar
    hibernate-annotations.jar
    hibernate-commons-annotations.jar
  4. Create new file jboss-deployment-structure.xml and add it to jboss-seam-jpa.war/WEB-INF/ with the following content:
<jboss-deployment-structure> 
   <deployment>
        <exclusions>
          <module name="javax.faces.api" slot="main"/>
          <module name="com.sun.jsf-impl" slot="main"/>
        </exclusions>
        <dependencies>
          <module name="org.apache.commons.logging" />
          <module name="org.apache.commons.collections" />
          <module name="org.apache.log4j" />
          <module name="org.dom4j" />
          <module name="javax.faces.api" slot="1.2"/>
          <module name="com.sun.jsf-impl" slot="1.2"/>
        </dependencies>
    </deployment>   
</jboss-deployment-structure>

 

 

I will shortly describe why I did step 3 and 4. By default Jboss AS 7 is configured for JSF2, but Seam 2 is integrated with JSF 1.2, so thanks to class loading isolation we can have in Jboss AS 7 set up more than one version of the same library in our case JSF 1.2 and JSF 2. Both JSF's implementations are preconfigured in AS7 release, we just have to include 1.2 slot and default JSF 2  to exclude from web application deployment. The remaining two dependencies – dom4j and commons logging is provided by container and Seam 2 expects them as provided.

 

Last step 4 is replacement of provided hibernate dependencies and their dependencies, which are bundled directly in web application WEB-INF/lib subdirectory. This is because Seam 2 is integrated with older hibernate versions which is not backward compatible with hibernate what is in AS7.

 

Enjoy new JBoss AS 7 with „old“ Seam2!

Today Seam Team released important security release, announcement is available at http://seamframework.org/Community/Seam222FinalSecurityRelease

 

This release is micro edition and it fixes only 4 issues. I strongly recommend to upgrade from the previous releases to this release.

Many people asked me when Seam 2 finally supports JSF2. And I am still answering it is in process. I feel ashamed that I have still the same answer. So I decide to blog about it a little.

 

First Seam 2.2.1.Final is the latest release and it runs with JSF2 with a few limitations. Biggest issue is that JSF2 incorporates jsf-facelets in different packages than it was for jsf-facelets 1.1.x. Seam UI is integrated with 1.1.x and therefore there are similar issues like JBSEAM-4637. This can't be resolved without a hack or providing Seam UI for JSF 1.2 and JSF 2 simultaneously. At the same time Seam 2 is _almost_ complete with its functional feature set. The real development lies in Seam 3 and Java EE 6.

 

Although the most user wanted missing feature in Seam2 is full maven support. And that goes hand in hand with more modern and flexible way of build system, which should give us an advance in solving also JSF2 support.

 

I multiple times wrote in Forum comments on seamframework.org, I am in the middle of transformation to Maven build system. You can track this effort on my personal github repository and not only monitor it, but also contribute and fork it and send pull requests if you want to get speed up with the development.

 

Because  I am also paid by Red Hat for our enterprise offering in Enterprise Application Platforn and Web Framework Kit, I have to divide my working time between my priority duties EAP/WFK and secondary in community Seam2 project.

 

Right now I and Martin Genčúr is migrating examples into maven structure. Registration example is done and very soon will be done also Blog example. They can be taken as a pattern for other existing examples, which are now only copied from SVN to github repository.

 

My plan is after finishing important examples to maven,  release 2.3.0-Alpha. Then support for JSF2 will be added.

 

Stay tuned!

We have finished a long journey for 2.2.1, main target for the version was fixing bugs and deployment issues on JBoss AS 6.

 

Seam examples (Blog, DvdStore) got latest Hibernate Search features. This nice enhancement came from Sanne Grinovero who added also HIbernate Search 3.3.0 on JBoss AS 6 deployments. Available in seam/examples/blog and seam/examples/dvdstore examples, just launch ant -f build-jboss6.xml.

 

I have to thanks to all bug reporters and our developers who participated in 2.2.1 version, our QE team (Ondřej Skutka, Martin Genčúr and Jozef Hartinger) for all 3 candidate releases and this final quality assurance that 2.2.1 is ready to go.

 

Seam downloads are available at sourceforge.net, but due attack on souceforge.net previous week, their recovering is causing unstable downloading.

 

So you can download the release also with these links:

http://download.jboss.org/seam/2.2.1.Final/jboss-seam-2.2.1.Final.tar.gz

http://download.jboss.org/seam/2.2.1.Final/jboss-seam-2.2.1.Final.tar.gz.md5

http://download.jboss.org/seam/2.2.1.Final/jboss-seam-2.2.1.Final.zip.md5

http://download.jboss.org/seam/2.2.1.Final/jboss-seam-2.2.1.Final.zip

 

Documentation for 2.2.1.Final is available http://seamframework.org/Seam2/Documentation.

 

If you have issues with your current application in migration to JBoss AS 6, look at Seam examples for inspirations.

I have released  2.2.1.CR3  -  you can find more details at http://www.seamframework.org/Community/Seam221CR3IsOut.

Filter Blog

By date:
By tag: