I took Seam (1.2.1 GA)'s glassfish example and got it deployed to OC4J 11
(11.1.1.0.0). Here's how I did it:
Keep in mind, the glassfish example compiles into an ear file, so these
instructions involve how to manually deploy an ear file to OC4J...see below for
hints on how to manually deploy a war file to OC4J. Also...THIS DOES NOT WORK
in OC4J 10, since OC4J 11 is the first release which is fully Java EE 5.0
compatible (according to
http://www.oracle.com/technology/tech/java/oc4j/index.html).
---
Section 1: Change some code so OC4J doesn't choke on it
(1) change persistence.xml:
(add this line)
| property name=hibernate.transaction.manager_lookup_class
| value=org.hibernate.transaction.OrionTransactionManagerLookup/
|
(delete this line if not using Derby)
property name=hibernate.dialect value=org.hibernate.dialect.DerbyDialect/
|
(2) change web.xml:
(delete this line in the ejb reference for
jboss-seam-glassfish/AuthenticatorAction/local)
| local-home/
|
(3) make the following classes implement Serializable (Oracle chokes on them,
saying they don't adhere to the EJB 2.1 spec if you don't, which is lame):
| ChangePasswordAction.java
| HotelBookingAction.java
| HotelSearchingAction.java
| RegisterAction.java
|
(4) update conversations.xhtml to be the latest in CVS, as there's a bug in it
which will cause an XML parsing error:
http://fisheye.jboss.com/browse/JBoss/jboss-seam/examples/booking/view/conversations.xhtml?ignore1=Bignore2=wk=r1=1.8r2=1.9u=3
---
Section 2: Configuring OC4J to see and successfully run your application
(1) configure oc4j/j2ee/home/config/server.xml:
(add this line)
| application name=jboss-seam-glassfish
path=../../home/applications/jboss-seam-glassfish.ear
| parent=default start=true /
|
(2) configure oc4j/j2ee/home/config/default-web-site.xml:
(add this line)
| web-app application=jboss-seam-glassfish name=jboss-seam-glassfish
| load-on-startup=true root=/jboss-seam-glassfish /
|
(3) configure oc4j/j2ee/home/config/data-sources.xml:
(add these lines, which assume you have a MySQL database installed and
available, given the following url, user and password)
| managed-data-source user=test password=test
connection-pool-name=mysqlDS
| jndi-name=jdbc/__default name=jdbc/__default/
| connection-pool name=mysqlDS
| connection-factory
factory-class=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
| user=test password=test url=jdbc:mysql://localhost:3306/test
commit-record-table-name=/
| /connection-pool
|
(4) copy the following jar files to the oc4j/j2ee/home/applib directory:
| commons-beanutils-core.jar **can be found in oc4j/j2ee/home/lib
| commons-digester.jar **can be found in oc4j/j2ee/home/lib
| jsf-api.jar **can be found in oc4j/lib/java/shared/oracle.jsf/1.2
| jsf-impl.jar **can be found in oc4j/lib/java/shared/oracle.jsf/1.2
| sun-commons-beanutils.jar **can be found in
oc4j/lib/java/shared/oracle.jsf/1.2
| sun-commons-collections.jar **can be found in
oc4j/lib/java/shared/oracle.jsf/1.2
| sun-commons-digester.jar **can be found in
oc4j/lib/java/shared/oracle.jsf/1.2
| sun-commons-logging.jar **can be found in
oc4j/lib/java/shared/oracle.jsf/1.2
| jboss-seam.jar **can be found in the root of your Seam directory
| hibernate-all.jar **can be found in [Seam directory]/lib
| jboss-ejb3-all.jar **can be found in [Seam directory]/lib
| thirdparty-all.jar **can be found in [Seam directory]/lib
| mysql-connector-java-5.0.4-bin.jar (if using MySql)
|
---
Section 3: Deploy your application to OC4J
(1) run ant clean main in the examples/glassfish directory
(2) copy the ear file from the examples/glassfish/build directory to the
oc4j/j2ee/home/applications directory
(3) copy the jar file from the examples/glassfish/build directory to the
oc4j/j2ee/home/applib directory
(4) start up oc4j and enjoy
---
You'll get some warnings and stuff (it's possible to do some more code and
configuration tweaks to get rid of them), but your app should work.
---
---
Some other helpful hints:
(1) if you're not using an ear file, but rather a war file, you'll need to do a
couple other (different from Section 2 above) things:
(a) register both the ejb jar and the war fiile in
oc4j/j2ee/home/config/application.xml:
| ejb-module id=jboss-seam-glassfish_ejb
path=../../home/applications/jboss-seam-glassfish.jar/
| web-module id=jboss-seam-glassfish
path=../../home/applications/jboss-seam-glassfish.war/
|
(b) register your app in oc4j/j2ee/home/config/default-web-site.xml:
| web-app application=default name=jboss-seam-lunchvote
root=/jboss-seam-lunchvote load-on-startup=true /
|
(note the application is simply default)
(c) don't change oc4j/j2ee/home/config/server.xml
(d) make sure the ejb-module id you specify (in this case,