SeamFramework.orgCommunity Documentation
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.
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:
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.
You may need to change the the
server1001_XX.bin
file to be
executable:
chmod a+x server1001_XX.bin
Execute the install:
./server1001_XX.bin
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.:
/jboss/apps/bea
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.
Then you need to tell it where to install the server components:
$BEA_HOME/wlserver_10.0
A Weblogic domain is similar to a JBoss server configuration - it is a self contained server instance. The Weblogic server you just installed has some example domains, but we are going to create one just for the seam examples. You can use the existing domains if you wish (modify the instructions as needed).
Start up the Weblogic configuration wizard:
$BEA_HOME/wlserver_10.0/common/bin/config.sh
Choose to create a new domain, configured to support
Weblogic Server
. Note that this is
the default domain option.
Set a username and password for this domain.
Next choose Development Mode
and
the default JDK when given the option.
The next screen asks if you want to customize any setting.
Select No
.
Finally set the name of the domain to
seam_examples
and leave the default
domain location.
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.
Starting the domain:
This is the easy part - go to the
$BEA_HOME/user_projects/domains/seam_examples/bin
directory and run the
./startWeblogic.sh
script.
Accessing the configuration console:
Launch
http://127.0.0.1:7001/console
in
your web browser. It will ask for your username and password
that you entered before. We won't get into this much now, but
this is the starting point for a lot of the various
configurations that are needed later.
Stopping the domain:
There are a couple of options here:
The recommended way is through the configuration console:
Select
seam_examples
on the
left hand side of the console.
Choose the
Control
tab in the
middle of the page.
Select the check box
AdminServer
in the
table.
Choose Shutdown
just above the table, and select either
When work completes
or Force shutdown now
as appropriate.
Then finally confirm that you want to shut this server down.
Hitting Ctrl-C
in the
terminal where you started the domain.
No negative effects have been seen, but we would not recommend doing this while in the middle of configuration changes in the console.
When using the
@DOMAIN/autodeploy
directory as
described in this chapter you may see
NoClassDefFound
exceptions. If
you see this try restarting the Weblogic server. If you
still see it remove the auto-deployed EAR/WAR files,
restart the server, and redeploy. We could not find a
specific reason for this, but others seem to be having this
issue as well.
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:
java.io.IOException: Compiler failed executable.exec: /jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer /cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/ TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:194: modifier transient not allowed here public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0, java.lang.Object[] arg1) ^ /jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer /cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/ TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:275: 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.
Copy hsqldb.jar
to the Weblogic
domain's shared library directory: cp
../../../lib/hsqldb.jar
/jboss/apps/bea/user_projects/domains/seam_examples/lib
Start up the server and navigate to the administration console following Section 34.1.3, “How to Start/Stop/Access your domain”
On the left side tree navigate
seam_examples - Services- JDBC - Data
Sources
.
You must lock the domain configuration using the button in the upper left box.
Then select the New
button at the top of the data source table
Fill in the following:
Name:
seam-jee5-ds
JNDI Name:
seam-jee5-ds
Database Type and Driver:
other
Select Next
button
Select Next
button on the
Transaction Options
page
Fill in the following on the Connection
Properties
page:
Database Name:
hsqldb
Host Name:
127.0.0.1
Port: 9001
Username: sa
will
empty password fields.
Select Next
button
Fill in the following on the Connection
Properties
page:
Driver Class Name:
org.hsqldb.jdbcDriver
URL:
jdbc:hsqldb:.
Username: sa
will
empty password fields.
Leave the rest of the fields as is.
Select Next
button
Choose the target domain for the data source in our
case the only one AdminServer
.
Click Next
.
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.
In the administration console navigate to the
Deployments
page using the left hand
menu.
You must lock the domain configuration using the button in the upper left box.
Then select the Install
button at the top of the deployments table
Using the directory browser navigate to the
/jboss/apps/bea/wlserver_10.0/common/deployable-libraries
directory. Then select the jsj-1.2.war
archive, and click the Next
button.
Make sure that the Install this deployment
as a library
is selected. Click the Next
button on the Install Application
Assistant
page.
Click the Next
button on the
Optional Settings
page.
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.
On the Settings for jsf(1.2,1.2.3.1)
page set the Deployment Order
to
99
so that it is deployed prior to
autodeployed applications. Then click the
Save
button.
Then activate the changes by clicking the green button in the upper left.
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
Shutdown the server following Section 34.1.3, “How to Start/Stop/Access your domain”
Then execute
cp ../../../lib/jsf-api.jar /jboss/apps/bea/user_projects/domains/seam_examples/lib
. Verify the jar was copied correctly.
Start up the server and navigate to the administration console following Section 34.1.3, “How to Start/Stop/Access your domain”
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.
resources/META-INF/persistence.xml
Change the
jta-data-source
to what you entered above :
<jta-data-source>seam-jee5-ds</jta-data-source>
Then comment out the glassfish properties.
Then add these two properties for weblogic support.
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
resources/META-INF/weblogic-application.xml
This file needs to be created and should contain the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<weblogic-application>
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</weblogic-application>
These changes do two two different things.
The first element
library-ref
tells weblogic that this application will
be using the deployed JSF libraries. The
second element
prefer-application-packages
tells weblogic that the
antlr
jars take precedence. This avoids a
conflict with hibernate.
resources/META-INF/ejb-jar.xml
The changes described here work around an
issue where Weblogic is only using a
single instance of the
sessionBeanInterceptor
for all session beans. Seam's interceptor
caches and stores some component specific
attributes, so when a call comes in - the
interceptor is primed for a different
component and an error is seen. To solve
this problem you must define a separate
interceptor binding for each EJB you wish
to use. When you do this Weblogic will use
a separate instance for each EJB.
Modify the
assembly-descriptor
element to look like this:
<assembly-descriptor>
<interceptor-binding>
<ejb-name>AuthenticatorAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>BookingListAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>RegisterAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>ChangePasswordAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>HotelBookingAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>HotelSearchingAction</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
<interceptor-binding>
<ejb-name>EjbSynchronizations</ejb-name>
<interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
</interceptor-binding>
</assembly-descriptor>
resources/WEB-INF/weblogic.xml
This file needs to be created and should contain the following:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
</weblogic-web-app>
This file and the element
library-ref
tells Weblogic that this application will
using the deployed JSF libraries. This is
needed in both this file and the
weblogic-application.xml
file because both applications require
access.
resources/WEB-INF/web.xml
Because the
jsf-impl.jar
is not going to be in the
$WAR/WEB_INF/lib
directory we need to add a configuration
listener to this file.
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
There are some changes needed to the build script and the
jboss-seam.jar
then we can deploy the app.
build.xml
Add the following to the
build.xml
. Note that
richfaces-api.jar
is only needed if using the admin console
to deploy. For some reason Weblogic needs
it in the
WAR
when it scans the application.
<fileset id="war.lib.extras" dir="${seam.dir}">
<include name="lib/richfaces-api.jar" />
</fileset>
Next we need to add the follow so that the
weblogic-application.xml
will be packaged.
<!-- Resources to go in the ear -->
<fileset id="ear.resources" dir="${resources.dir}">
<include name="META-INF/application.xml" />
<include name="META-INF/weblogic-application.xml" />
<include name="META-INF/*-service.xml" />
<include name="META-INF/*-xmbean.xml" />
<include name="treecache.xml" />
<include name="*.jpdl.xml" />
<exclude name=".gpd.*" />
<include name="*.cfg.xml" />
<include name="*.xsd" />
</fileset>
$SEAM/lib/interop/jboss-seam-wls-compatible.jar
This is the change discussed above in Section 34.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 /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy
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 34.2.2.2, “Setting up Weblogics JSF Support”.
Step one setup the datasource, step two build the app, step three deploy.
The Weblogic 10.X version of the example will use the in
memory hsql database instead of the built in PointBase
database. If you wish to use the PointBase database you
must setup a PointBase datasource, and adjust the
hibernate setting in
persistence.xml
to use the PointBase dialect. For reference the
jpa/weblogic92
example uses PointBase.
Configuring the datasource is very similar to the jee5 Section 34.2.2.1, “Setting up the hsql datasource” . Follow the steps in that section, but use the following entries where needed.
DataSource Name:
seam-jpa-ds
JNDI Name:
seam-jpa-ds
Building it only requires running the correct ant command:
ant weblogic10.xml
This will create a container specific distribution and exploded archive directories.
When we installed Weblogic following Section 34.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-weblogic10/jboss-seam-jpa.war /jboss/apps/bea/user_projects/domains/seam_examples/autodeploy
Check out the application at the following
http://localhost:7001/jboss-seam-jpa/
.
Between the the Weblogic 10.x and 9.2 examples there are several differences:
META-INF/persistence.xml
— The 9.2 version is configured to use the
PointBase
database and a
pre-installed datasource. The 10.x version uses
the hsql
database and a
custom datasource.
WEB-INF/weblogic.xml
— This file and its contents solve an issue
with an older version of the
ANTLR
libraries that
Weblogic 10.x uses internally. OC4J have the same
issue as well. It also configures the application to
use the shared JSF libraries that were installed
above.
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
This make Weblogic use classes and
libraries in the web application before other
libraries in the classpath. Without this change
hibernate is required to use a older, slower query
factory by setting the following property in the
META-INF/persistence.xml
file.
<property name="hibernate.query.factory_class"
value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
WEB-INF/components.xml
— In the Weblogic 10.x version JPA entity
transactions is enabled by adding:
<transaction:entity-transaction entity-manager="#{em}"/>
WEB-INF/web.xml
— Because the jsf-impl.jar
is not in the WAR
this listener
need to be configured :
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
Between the Weblogic 10.x version and the JBoss version there are more changes. Here is the rundown:
META-INF/persistence.xml
— Except for datasource name the Weblogic
version sets:
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
WEB-INF/lib
— The
Weblogic version requires several library
packages because they are not included as they are
with JBoss AS. These are primarily for hibernate,
and its dependencies.
To use Hibernate as your JPA provider you need the following jars:
hibernate.jar
hibernate-annotations.jar
hibernate-entitymanager.jar
hibernate-validator.jar
jboss-common-core.jar
commons-logging.jar
commons-collections.jar
jboss-common-core.jar
Various third party jars that Weblogic needs:
antlr.jar
cglib.jar
asm.jar
dom4j.jar
el-ri.jar
javassist.jar
concurrent.jar
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 init: setup: [echo] Welcome to seam-gen :-) [input] Enter your Java project workspace (the directory that contains your Seam projects) [C:/Projects] [C:/Projects] /home/jbalunas/workspace [input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.2.GA] [C:/Program Files/jboss-4.2.2.GA] /jboss/apps/jboss-4.2.2.GA [input] Enter the project name [myproject] [myproject] weblogic-example [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, ) war [input] Enter the Java package name for your session beans [org.jboss.seam. tutorial.weblogic.action] [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] 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] org.jboss.seam.tutorial.weblogic.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] [lib/hsqldb.jar] [input] Enter JDBC driver class for your database [org.hsqldb.jdbcDriver] [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: /rhdev/projects/jboss-seam/cvs-head/jboss-seam/seam-gen/build.properties [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 BUILD SUCCESSFUL
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.
build.xml
Change the default target to
archive
.
<project name="weblogic_example" default="archive" basedir=".">
resources/META-INF/persistence-dev.xml
Alter the
jta-data-source
to
be seam-gen-ds
(and
use this as the
jndi-name
when
creating the data source in Weblogic's
admin console)
Change the transaction type to
RESOURCE_LOCAL
so that we can use JPA transactions.
<persistence-unit name="weblogic_example" transaction-type="RESOURCE_LOCAL">
Add/modify the properties below for Weblogic support:
<property name="hibernate.cache.provider_class"
value="org.hibernate.cache.HashtableCacheProvider"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
You'll need to alter
persistence-prod.xml
as well if you want to deploy to Weblogic
using the prod profile.
resource/WEB-INF/weblogic.xml
You will need to create this file and populate it following description of WEB-INF/weblogic.xml.
resource/WEB-INF/components.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.
xmlns:transaction="http://jboss.com/products/seam/transaction"
http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
resource/WEB-INF/web.xml
WEB-INF/web.xml
— Because the
jsf-impl.jar
is not in the
WAR
this listener need to be configured :
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
resources/WEB-INF/jboss-app.xml
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)
resources/*-ds.xml
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 34.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" />
</fileset>
</copy>
There is currently an issue with the behavior of the
seam-gen WAR
application when built using
the development profile (the default) and deployed to Weblogic.
The symptom is that the login page of the application will always
show a login failed
message.
When the application is built using the development profile
the action
class files are placed in the
WEB-INF/dev
directory. Normally these
class files are hot deployable and managed by Seam. This does not
happen on Weblogic (see
jira JBSEAM-2455 for details and status).
To workaround this you need to modify the
build-dev.properties
file. Simply
remove the property
action.dir=WEB-INF/dev
.
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 34.2.2.1, “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 34.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/
.
.