SeamFramework.orgCommunity Documentation

Chapter 37. Seam on BEA's Weblogic

37.1. Installation and operation of Weblogic
37.1.1. Installing 10.3
37.1.2. Creating your Weblogic domain
37.1.3. How to Start/Stop/Access your domain
37.1.4. Setting up Weblogic's JSF Support
37.2. The jee5/booking Example
37.2.1. EJB3 Issues with Weblogic
37.2.2. Getting the jee5/booking Working
37.3. The jpa booking example
37.3.1. Building and deploying jpa booking example
37.3.2. What's different with Weblogic 10.x
37.4. Deploying an application created using seam-gen on Weblogic 10.x
37.4.1. Running seam-gen setup
37.4.2. What to change for Weblogic 10.X
37.4.3. Building and Deploying your application

Weblogic 10.3 is BEA's latest stable JEE5 server offering. 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 specific to Weblogic.

First step is to get Weblogic downloaded, installed and running. Then we'll talk about Seam's JEE5 example and the hurdles to getting it running. After that, the JPA example will be 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. There are some outstanding issues that were not addressed in 10.3, but it does solve some of the issues discussed below without the need for BEA patches. The previous release 10.0.MP1 is also available, but requires some BEA patches to function correctly.

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 the known BEA issues.

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

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

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

    chmod a+x server103_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. You can leave the defaults for the component installation locations on the next page.

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.

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. For complete details see Weblogic 10.3 Configuring JSF and JSTL Libraries

  1. In the administration console navigate to the Deployments page using the left hand menu.

  2. Then select the Install button at the top of the deployments table

  3. Using the directory browser navigate to the $BEA_HOME/wlserver_10.3/common/deployable-libraries directory. Then select the jsf-1.2.war archive, and click the Next button.

  4. Make sure that the Install this deployment as a library is selected. Click the Next button on the Install Application Assistant page.

  5. Click the Next button on the Optional Settings page.

  6. Make sure that the Yes, take me to the deployment's configuration screen. is selected. Click the Finish button on the Review your choices and click Finish page.

  7. On the Settings for jsf(1.2, page set the Deployment Order to 99 so that it is deployed prior to auto deployed applications. Then click the Save button.

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 for this to work is to put the javax.jsf_1.2.0.0.jar (the jsf-api.jar) from jsf-1.2.war in the domains shared library. This requires a restart of the server.

Do you want to run Seam using EJB's on Weblogic? If so there are some obstacles that you will have to avoid, or some patches that are needed from BEA. 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 generates stubs and compiles EJB's that use variable arguments in their methods. This is confirmed in the Weblogic 9.X and 10.0.MP1 versions. Unfortunately the 10.3 version only partially addresses the issue as detailed below.

The basic explanation of the issue is that the Weblogic EJB compiler mistakes methods that use varargs as having the transient modifier. When BEA generates its own stub class from those classes during deployment it fails and the deployment does not succeed. Seam uses variable arguments in one of its internal EJB's ( TimerServiceDispatcher). If you see exceptions like below during deployment you are running an unpatched version of 10.0.MP1. 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)

This issue has been fixed in Weblogic 10.3, and BEA has created a patch for Weblogic 10.0.MP1 ( CR327275 ) for this issue that can be requested from their support.

Unfortunately a second issue has been reported and verified by BEA.

This issue was only found once the CR327275 patch had been applied to 10.0.MP1. This new issue has been confirmed by BEA and they created a patch for 10.0.MP1 that addresses this issue. This patch has been referred to as both CR370259 and CR363182. As with the other patch this can be requested through the BEA support.

This issue causes certain EJB methods to be incorrectly left out of Weblogic's generated internal stub classes. This results in the following error messages during deployment.

<<Error> <EJB> <BEA-012036> <Compiling generated EJB classes produced the following Java compiler error message:
<Compilation Error> The type TimerServiceDispatcher_qzt5w2_Impl must implement the inherited abstract method TimerServiceDispatcher_qzt5w2_Intf.scheduleTimedEvent(String, Schedule, Object[])
<Compilation Error> Type mismatch: cannot convert from Object to Timer
<Compilation Error> Type mismatch: cannot convert from Object to Timer> 
<Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1223409267344' for task '0'. Error is: 'weblogic.application.ModuleException: Exception preparing module: EJBModule(jboss-seam.jar)

It appears that when Weblogic 10.3 was released the neglected to include this fix!! This means that Weblogic 10.0.MP1 with patches will function correctly, but 10.3 will still require the special Seam jar described below. Not all users have seen this and there may be certain combinations of OS/JRE that do not see this, however is has been seen many times. Hopefully Oracle/BEA will release an updated patch for this issue on 10.3. When they do we will update this reference guide as needed.

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. Obviously with this jar you will not be able to use the TimerServiceDispatcher functionality.

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 $SEAM_HOME/lib/hsqldb.jar $BEA_HOME/user_projects/domains/seam_examples/lib

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

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

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

  5. 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

  6. Select Next button on the Transaction Options page

  7. 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. Password: leave empty.

    6. Select Next button

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

    1. Driver Class Name: org.hsqldb.jdbcDriver

    2. URL: jdbc:hsqldb:.

    3. Username: sa

    4. Password: leave empty.

    5. Leave the rest of the fields as is.

    6. Select Next button

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

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.

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 with Seam POJOs 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 37.1.4, “Setting up Weblogic's 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.3.GA] 
[C:/Program Files/jboss-4.2.3.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 [/tmp/seamlib/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.3.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 37.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" />

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 37.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/. .