SeamFramework.orgCommunity Documentation
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.
Weblogic 10.0.MP1
—
Download page
10.0.MP1 has some known issues with EJBs that use
varargs
in their methods (it confuses them
as transient
), as well as some others.
See Section 39.2.1, “EJB3 Issues with Weblogic” for full details on
the issues and the work around.
Weblogic 10.3
—
Download page
This is the latest stable release of the Weblogic server, and the one that will be used with the examples below. This version has addressed some of the issues with EJBs that were in 10.0.MP1. However one of the changes did not make it into this release. See Section 39.2.1, “EJB3 Issues with Weblogic” for the details, but because of this we still need to use the special Weblogic seam jar discussed below.
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:
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.
You may need to change the the
server103_XX.bin
file to be
executable:
chmod a+x server103_XX.bin
Execute the install:
./server103_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.
You can leave the defaults for the component installation locations on the next page.
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.3/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.
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
/autodeploy
directory as
described in this chapter you may see
NoClassDefFound
exceptions during
redeployment's. 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.
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
In the administration console navigate to the
Deployments
page using the left hand
menu.
Then select the Install
button at the top of the deployments table
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.
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
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.
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)
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> TimerServiceDispatcher_qzt5w2_Impl.java: The type TimerServiceDispatcher_qzt5w2_Impl must implement the inherited abstract method TimerServiceDispatcher_qzt5w2_Intf.scheduleTimedEvent(String, Schedule, Object[]) <Compilation Error> TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java: Type mismatch: cannot convert from Object to Timer <Compilation Error> TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java: 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.
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
Start up the server and navigate to the administration console following Section 39.1.3, “How to Start/Stop/Access your domain”
On the left side tree navigate
seam_examples - Services- JDBC - Data
Sources
.
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.
Password: leave empty.
Select Next
button
Fill in the following on the Connection
Properties
page:
Driver Class Name:
org.hsqldb.jdbcDriver
URL:
jdbc:hsqldb:.
Username: sa
Password: leave empty.
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
.
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.
There are some changes needed to the build script and the
jboss-seam.jar
then we can deploy the app.
build.xml
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 39.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 $BEA_HOME/user_projects/domains/seam_examples/autodeploy
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 39.1.4, “Setting up Weblogic's 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 39.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
This will create a container specific distribution and exploded archive directories.
When we installed Weblogic following Section 39.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 $BEA_HOME/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.3.GA] [C:/Program Files/jboss-4.2.3.GA] /jboss/apps/jboss-4.2.3.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 [/tmp/seamlib/hsqldb.jar] [/tmp/seam/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.3.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.2.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-web.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 39.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>
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 39.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 39.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/
.
.