SeamFramework.orgCommunity Documentation

Chapter 36. Seam on BEA's Weblogic

36.1. Installation and operation of Weblogic
36.1.1. Installing 10.0.MP1
36.1.2. Creating your Weblogic domain
36.1.3. How to Start/Stop/Access your domain
36.2. The jee5/booking Example
36.2.1. EJB3 Issues with Weblogic
36.2.2. Getting the jee5/booking Working
36.3. The jpa booking example
36.3.1. Building and deploying jpa booking example
36.3.2. What's different with Weblogic 10.x
36.4. Deploying an application created using seam-gen on Weblogic 10.x
36.4.1. Running seam-gen setup
36.4.2. What to change for Weblogic 10.X
36.4.3. Building and Deploying your application

Weblogic 10.X is BEA's JEE5 server offering, currently 10.0.MP1 is their stable release, and 10.3.TP is their latest tech preview release. Seam applications can be deployed and developed on Weblogic servers, and this chapter will show you how. There are some known issues with the Weblogic servers that will need to be worked around, and configuration changes that are needed.

First step is to get Weblogic downloaded, installed and running (no small feat). Then we'll talk about Seam's JEE5 example and the hurdles to getting it running. After that, the JPA example will be modified and deployed to the server. Then finally we will create a seam-gen application and get it up and running to provide a jump start to your own application.

First things first we need to get the server installed - and there is a choice to be made. Weblogic 10.0.MP1 is the most recent stable release, while 10.3.TP is a technical preview version that fixes some things and breaks others.

  • Weblogic 10.0.MP1 Download page

    10.0.MP1 has a known issue with EJBs that use varargs in their methods (it confuses them as transient ). This causes exceptions when Weblogic attempts to compile the Seam EJBs. There is a BEA support patch available to fix this issue, but BEA is currently working on a second issue related to the EJBs. See the jee5/booking example for more details.

  • Weblogic 10.3.TP Download page

    This version still has not fixed the varargs bug, and there is a new issue with EJBs that do not use kodo (BEA's implementation of JPA). BEA has said that the varargs issue will be resolved in the final version of 10.3, but the kodo issue is a blocker for getting the jee5/booking working.

Special jboss-seam.jar for Weblogic EJB Support

Starting with Seam 2.0.2.CR2 a special Weblogic specific jar has been created that does not contain the TimerServiceDispatcher . This is the EJB that uses varargs and exposes the second EJB issue. We will be using this jar for the jee5/booking example, as it avoids both known BEA issues.

Here are the quick steps to installing Weblogic 10.1.MP1. For more details or if you are having any issues please check with the BEA docs at the Weblogic 10.0 Doc Center . Here we install the RHEL 5 version using the graphical installer:

  1. Follow the link given above for 10.0.MP1 and download the correct version for your environment. You will need to sign up for an account with BEA in order to do this.

  2. You may need to change the the server1001_XX.bin file to be executable:

    chmod a+x server1001_XX.bin
  3. Execute the install:

  4. When the graphical install loads, you need to set the BEA home location. This is where all BEA applications are installed. This location will be known as $BEA_HOME in this document e.g.:

  5. Select Complete as the installation type. You do not need all the extras of the complete install (such as struts and beehive libraries), but it will not hurt.

  6. Then you need to tell it where to install the server components:


Now that the server is installed and the domain is created you need to know how to start and stop it, plus how to access its configuration console.

Do you want to run Seam using EJB's on Weblogic? If so there are some obstacles that you will have to avoid. This section describes those obstacles and what changes are needed to the jee5/booking example to get it deployed and functioning.

For several releases of Weblogic there has been an issue with how Weblogic compiles EJB's that use variable arguments in their methods. This is confirmed in the Weblogic 9.X and 10.X versions. Seam uses variable arguments in one of its internal EJB's ( TimerServiceDispatcher ). So Seam will not function correctly without modifications.

The basic explanation of the issue is that the Weblogic EJB compiler believes that methods that use varargs are transient and the deployment will fail with exceptions like below: Compiler failed executable.exec: 
/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/ modifier transient 
not allowed here
  public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0,
  java.lang.Object[] arg1)
/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/ modifier transient
not allowed here
  public transient javax.ejb.Timer scheduleTimedEvent(java.lang.String arg0, 
  org.jboss.seam.async.TimerSchedule arg1, java.lang.Object[] arg2)

BEA has created a patch ( CR327275 ) for this issue that can be requested from their support. It is rumored that it will be included in the final release of Weblogic 10.3, although not confirmed.

Unfortunately a second issue has been reported and verified by BEA ( CR363182 ). This issue has to do with certain EJB methods incorrectly left out of Weblogic's generated internal stub classes. At the time of this writing the status of this issue is not known. When this issue has been patched, and tested with Seam this reference guide chapter will be updated.

So that Seam's users can deploy an EJB application to Weblogic a special Weblogic specific jar has been created, starting with Seam 2.0.2.CR2. It is located in the $SEAM/lib/interop directory and is called jboss-seam-wls-compatible.jar . The only difference between this jar and the jboss-seam.jar is that it does not contain the TimerServiceDispatcher EJB. To use this jar simply rename the jboss-seam-wls-compatible.jar to jboss-seam.jar and replace the original in your applications EAR file. The jee5/booking example demonstrates this.

In this section we will go over the steps needed to get the jee5/booking example to up and running.

This example uses the in memory hypersonic database, and the correct data source needs to be set up. The admin console uses a wizard like set of pages to configure it.

  1. Copy hsqldb.jar to the Weblogic domain's shared library directory: cp ../../../lib/hsqldb.jar /jboss/apps/bea/user_projects/domains/seam_examples/lib

  2. Start up the server and navigate to the administration console following Section 36.1.3, “How to Start/Stop/Access your domain”

  3. On the left side tree navigate seam_examples - Services- JDBC - Data Sources.

  4. You must lock the domain configuration using the button in the upper left box.

  5. Then select the New button at the top of the data source table

  6. Fill in the following:

    1. Name: seam-jee5-ds

    2. JNDI Name: seam-jee5-ds

    3. Database Type and Driver: other

    4. Select Next button

  7. Select Next button on the Transaction Options page

  8. Fill in the following on the Connection Properties page:

    1. Database Name: hsqldb

    2. Host Name:

    3. Port: 9001

    4. Username: sa will empty password fields.

    5. Select Next button

  9. Fill in the following on the Connection Properties page:

    1. Driver Class Name: org.hsqldb.jdbcDriver

    2. URL: jdbc:hsqldb:.

    3. Username: sa will empty password fields.

    4. Leave the rest of the fields as is.

    5. Select Next button

  10. Choose the target domain for the data source in our case the only one AdminServer. Click Next.

  11. Finally - apply the changes by selecting the Apply Changes button in the upper left corner.

These are the instructions to deploy and configure Weblogic's JSF 1.2 libraries. Out of the box Weblogic does not come with its own JSF libraries active, and unfortunately when deploying an EAR based application Weblogic requires its own JSF libraries to function. This appears to be caused by classloader issues. The assumption being that JSF libraries in the application are not visible to Weblogic during deployment of the EAR application. Why this does not effect WAR based applications is not known.

There is another step that is needed for this to work. For some reason, even with the steps above classes in the jsf-api.jar are not found during application deployment. The only way I found for this to work is to put the jsf-api.jar from $SEAM/lib directory in the domains shared library /jboss/apps/bea/user_projects/domains/seam_domain/lib

  1. Shutdown the server following Section 36.1.3, “How to Start/Stop/Access your domain”

  2. Then execute cp ../../../lib/jsf-api.jar /jboss/apps/bea/user_projects/domains/seam_examples/lib . Verify the jar was copied correctly.

  3. Start up the server and navigate to the administration console following Section 36.1.3, “How to Start/Stop/Access your domain”

  4. Then verify a clean start up of the server.

OK - now we are ready to finally begin adjusting the seam application for deployment to the Weblogic server.


There are some changes needed to the build script and the jboss-seam.jar then we can deploy the app.

  • This is the change discussed above in Section 36.2.1, “EJB3 Issues with Weblogic” . There are really two options.

  • Rename this jar and replace the original $SEAM/lib/jboss-seam.jar file. This approach does not require any changes to the packaged EAR archive, but overwrites the original jboss-seam.jar

  • The other option is the modify the packaged EAR archive and replace the jboss-seam.jar in the archive manually. This leaves the original jar alone, but requires a manual step when ever the archive is packaged.

Assuming that you choose the first option for handling the jboss-seam-wls-compatible.jar we can build the application by running ant archive at the base of the jee5/booking example directory.

Because we chose to create our Weblogic domain in development mode we can deploy the application by putting the EAR file in the domains autodeploy directory.

                  cp ./dist/jboss-seam-jee5.ear

Check out the application at http://localhost:7001/seam-jee5/

This is the Hotel Booking example implemented in Seam POJO and Hibernate JPA and does not require EJB3 support to run. The example already has a breakout of configurations and build scripts for many of the common containers including Weblogic 10.X

First we'll build the example for Weblogic 10.x and do the needed steps to deploy. Then we'll talk about what is different between the Weblogic versions, and with the JBoss AS version.

Note that this example assumes that Weblogic's JSF libraries have been configured as described in Section, “Setting up Weblogics JSF Support”.

seam-gen is a very useful tool for developers to quickly get an application up and running, and provides a foundation to add your own functionality. Out of box seam-gen will produce applications configured to run on JBoss AS. These instructions will show the steps needed to get it to run on Weblogic.

seam-gen was build for simplicity so, as you can imagine, deploying an application generated by seam-gen to Weblogic 10.x is not too hard. Basically it consists of updating or removing some configuration files, and adding dependent jars that Weblogic 10.x does not ship with.

This example will cover the basic seam-gen WAR deployment. This will demonstrate Seam POJO components, Hibernate JPA, Facelets, Drools security, RichFaces, and a configurable dataSource.

The first thing we need to do it tell seam-gen about the project we want to make. This is done by running ./seam setup in the base directory of the Seam distribution. Note the paths here are my own, feel free to change for you environment.

./seam setup
Buildfile: build.xml


     [echo] Welcome to seam-gen :-)
    [input] Enter your Java project workspace (the directory that contains your 
Seam projects) [C:/Projects] [C:/Projects]
    [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.2.GA] 
[C:/Program Files/jboss-4.2.2.GA]
    [input] Enter the project name [myproject] [myproject]
     [echo] Accepted project name as: weblogic_example
    [input] Select a RichFaces skin (not applicable if using ICEFaces) [blueSky]
 ([blueSky], classic, ruby, wine, deepMarine, emeraldTown, sakura, DEFAULT)

    [input] Is this project deployed as an EAR (with EJB components) or a WAR 
(with no EJB support) [ear]  ([ear], war, )
    [input] Enter the Java package name for your session beans [org.jboss.seam.
tutorial.weblogic.action] [org.jboss.seam.tutorial.weblogic.action]
    [input] Enter the Java package name for your entity beans [org.jboss.seam.
tutorial.weblogic.model] [org.jboss.seam.tutorial.weblogic.model]
    [input] Enter the Java package name for your test cases [org.jboss.seam.
tutorial.weblogic.action.test] [org.jboss.seam.tutorial.weblogic.action.test]
    [input] What kind of database are you using? [hsql]  ([hsql], mysql, oracle,
 postgres, mssql, db2, sybase, enterprisedb, h2)

    [input] Enter the Hibernate dialect for your database [org.hibernate.
dialect.HSQLDialect] [org.hibernate.dialect.HSQLDialect]

    [input] Enter the filesystem path to the JDBC driver jar [lib/hsqldb.jar] 

    [input] Enter JDBC driver class for your database [org.hsqldb.jdbcDriver] 

    [input] Enter the JDBC URL for your database [jdbc:hsqldb:.] [jdbc:hsqldb:.]

    [input] Enter database username [sa] [sa]

    [input] Enter database password [] []

    [input] Enter the database schema name (it is OK to leave this blank) [] []

    [input] Enter the database catalog name (it is OK to leave this blank) [] []

    [input] Are you working with tables that already exist in the database? [n] 
 (y, [n], )

    [input] Do you want to drop and recreate the database tables and data in 
import.sql each time you deploy? [n]  (y, [n], )

    [input] Enter your ICEfaces home directory (leave blank to omit ICEfaces) [] []

[propertyfile] Creating new property file: 
     [echo] Installing JDBC driver jar to JBoss server
     [copy] Copying 1 file to /jboss/apps/jboss-4.2.2.GA/server/default/lib
     [echo] Type 'seam create-project' to create the new project


Type ./seam new-project to create your project and cd /home/jbalunas/workspace/weblogic_example to see the newly created project.

First we change and delete some configuration files, then we update the libraries that are deployed with the application.


You will need to create this file and populate it following description of WEB-INF/weblogic.xml.


We want to use JPA transactions so we need to add the following to let Seam know.

<transaction:entity-transaction entity-manager="#{entityManager}"/>

You will also need to add the transaction namespace and schema location to the top of the document.


WEB-INF/web.xml — Because the jsf-impl.jar is not in the WAR this listener need to be configured :


You can delete this file as we aren't deploying to JBoss AS ( jboss-app.xml is used to enable classloading isolation in JBoss AS)


You can delete these files as we aren't deploying to JBoss AS. These files define datasources in JBoss AS, in Weblogic we will use the administration console.

The seam-gen application has very similar library dependencies as the jpa example above. See Section 36.3.2, “What's different with Weblogic 10.x”. Below is the changes that are needed to get them in this application.

  • build.xml — Now we need to adjust the build.xml. Find the target war and add the following to the end of the target.

          <copy todir="${war.dir}/WEB-INF/lib">
             <fileset dir="${lib.dir}">
                <!-- Misc 3rd party -->
                <include name="commons-logging.jar" />
                <include name="dom4j.jar" />
                <include name="javassist.jar" />
                <include name="cglib.jar" />
                <include name="antlr.jar" />

                <!-- Hibernate -->
                <include name="hibernate.jar" />
                <include name="hibernate-commons-annotations.jar" />
                <include name="hibernate-annotations.jar" />
                <include name="hibernate-entitymanager.jar" />
                <include name="hibernate-validator.jar" />
                <include name="jboss-common-core.jar" />
                <include name="concurrent.jar" />

Finally all that's left is deploying the application. This involves setting up a data source, building the app, and deploying it.

Configuring the datasource is very similar to the jee5 Section, “Setting up the hsql datasource”. Except for what is listed here follow that instruction from the link.

  • DataSource Name: seam-gen-ds

  • JNDI Name: seam-gen-ds

When we installed Weblogic following Section 36.1.2, “Creating your Weblogic domain” we chose to have the domain in development mode. This means to deploy the application all we need to do is copy it into the autodeploy directory.

cp  ./dist/weblogic_example.war /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy

Check out the application at the following http://localhost:7001/weblogic_example/. .