JBoss 7 and JBoss EAP 6
Status
These steps have been tested with JBoss AS 7.1.1.Final "Brontes".
Deploy Orbeon Forms
To install Orbeon Forms:
- For Orbeon Forms PE
- Unzip
orbeon.war
place yourlicense.xml
file underWEB-INF/resources/config/license.xml
- Re-zip
orbeon.war
- Unzip
- Start a standalone server with
bin/standalone.sh
- Drop
orbeon.war
into the JBossstandalone/deployments
folder
Setup a JDBC datasource
To setup a datasource, if you'd like Orbeon Forms to connect to your relational database, here for MySQL:
- Setup Orbeon Forms to use a JBoss datasource (configured in the following steps):``
- Unzip
orbeon.war
, - Edit
WEB-INF/w``eb.xml
to uncomment the<resource-ref>
. - Edit
WEB-INF/jboss-web.xml
to uncomment the<resource-ref>
. Change the<jndi-name>
tojava:/comp/env/jdbc/mysql
.
- Unzip
In JBoss, install the JDBC driver as a module:
- In
modules/com
, create a directorymysql/main
. - Download the MySQL JDBC driver, say
mysql-connector-java-5.1.22-bin.jar
, and place it in themain
directory. In the
main
directory, create a file namedmodule.xml
with the following content. Update the value of thepath
attribute to match the name of the file you download in the previous step.<module xmlns="urn:jboss:module:1.0" name="com.mysql"> <resources> <resource-root path="mysql-connector-java-5.1.22-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
- In
In JBoss, define the datasource:
Editing
standalone/configuration/standalone.xml
, and replace the<datasources>
with the following.<datasources> <datasource jndi-name="java:/comp/env/jdbc/mysql" pool-name="mysql" enabled="true"> <connection-url>jdbc:mysql://localhost:3306/orbeon?useUnicode=true&characterEncoding=UTF8</connection-url> <driver>com.mysql</driver> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <pool> <min-pool-size>10</min-pool-size> <max-pool-size>100</max-pool-size> <prefill>true</prefill> </pool> <security> <user-name>orbeon</user-name> <password>orbeon</password> </security> <statement> <prepared-statement-cache-size>32</prepared-statement-cache-size> <share-prepared-statements>true</share-prepared-statements> </statement> </datasource> <drivers> <driver name="com.mysql" module="com.mysql"> <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> </driver> </drivers> </datasources>
- In
<connection-url>
, change the host and database name, and under<security>
the user name and password as appropriate.
(Optional) Check that the module and datasource are configured properly:
Starting JBoss (bin/standalone.sh) and verifying you see the following two lines in the console:
[org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1) [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/comp/env/jdbc/mysql]
Check the datasource properly shows in the JBoss Management console:
- If you haven't done so already, create a user in the
ManagementRealm
by runningbin/add-user.sh
, and creating a new user, sayadmin
/password
. - Go to
http://127.0.0.1:9990/console/
. Choose Profile on to top right of the page. Click on Connector / Datasources in the left sidebar. Check that you have an enabled datasource with JNDI namejava:/comp/env/jdbc/mysql
. In the Connection tab, click on Test Connection, and a dialog the message "Successfully created JDBC connection" should show.
- If you haven't done so already, create a user in the
- (Requires Orbeon Forms PE) Check you can create a database service in Form Builder :
- Create a new form in Form Builder, give it any app/form name.
- In the sidebar, add a Database service. Assuming you have an
employee
table in your database, name the serviceemployees
, usedb
for the datasource, andselect emp_no, first_name from employees limit 10
for the SQL query. (If you need sample data to populate your database, you can use data from these demo scripts.) - Add a Dropdown Menu control to the form (not Dynamic Data Dropdown), click on the gear icon, and name it
employees
. - In the sidebar, add an Action, name it
populate-employees
, have it react to from load, calling theemployees
service, under Set Response Selection Control Items (which is at the bottom of the dialog) click the plus icon, select theemployees
control, for Items use/response/row
, for Label usefirst-name
and for Value useemp-no
. - Click the Test button, and check that the list name shows in the dropdown.
Using the Oracle persistence layer
- Follow the steps in the previous section, using the Oracle driver instead of the MySQL driver.
Add to the
orbeon.war
, in theWEB-INF
directory, a file namedjboss-deployment-structure.xml
with the content that follows. This assumes, that in the previous step, you named the modulecom.oracle
.<jboss-deployment-structure> <deployment> <dependencies> <module name="com.oracle"/> <module name="org.jboss.ironjacamar.jdbcadapters"/> </dependencies> </deployment> </jboss-deployment-structure>
Orbeon Forms doesn't come by default with this file, so deployment on JBoss doesn't fail for those who are not using the Oracle persistence layer, and thus haven't create a
com.oracle
module.- Create the Orbeon tables in Oracle.
Setup Orbeon Forms to use the Oracle persistence layer. At the minimun, you'll need to add the following two properties to your
properties-local.xml
:<property as="xs:string" name="oxf.fr.persistence.provider.*.*.*" value="oracle"/> <property as="xs:string" name="oxf.fr.persistence.oracle.datasource" value="db"/>
With JBoss 6
Assuming that
JBOSS_HOME
represents the location of your JBoss installation: create a newJBOSS_HOME/server/default/deploy/orbeon.war
directory.Unzip the
orbeon.war
file in theorbeon.war
directory you just created.Depending on the version of JBoss you are using:
Create a file
orbeon.war/WEB-INF/jboss-scanning.xml
with the following content. This is get around a bug happening in the JBoss scanner when it goes through Scala classes. With Orbeon Forms 3.9:<scanning xmlns="urn:jboss:scanning:1.0"> <path name="WEB-INF/lib/scala-library-2.9.2.jar"> <exclude name="scala" recurse="true"/> </path> </scanning>
Make sure you replace
scala-library-*.jar
with the actual version number inWEB-INF/lib
. NOTE: Orbeon Forms 4.0 already includes this setting.Edit
orbeon.war/WEB-INF/jboss-web.xml
and comment the 4 lines that start with<resource-ref>
and end with</resource-ref>
. Thisresource-ref
is only useful if you want to setup Orbeon Forms to store data in a relational database. If this is the first time you are installing Orbeon Forms on JBoss, even if you ultimately want Orbeon Forms to store data in a relation database, we recommend you first get it up and running without this configuration. Once everything works, you can come back, uncomment this, and follow the steps in point #7 below to get Orbeon Forms to access your relational database.
- Start JBoss by running
JBOSS_HOME/bin/run.bat
(orrun.sh
on UNIX). - Run and modify the example applications.
- Go to
http://localhost:8080/orbeon/
- You can modify the example applications resources as the application sever is running and see the results of your modifications on the fly. The resources are stored under
JBOSS_HOME/server/default/deploy/orbeon.war/WEB-INF/resources
.
- Go to
Optionally, to run the authentication sample:
- Open
JBOSS_HOME/server/default/deploy/orbeon.war/WEB-INF/web.xml
and uncomment thesecurity-constraint
,login-config
andsecurity-role
declarations at the end of the file. - Open
JBOSS_HOME/server/default/deploy/orbeon.war/WEB-INF/jboss-web.xml
and uncomment the security-domain element near the end of bottom of the file. Open
JBOSS_HOME/server/default/conf/login-config.xml
and add the following aplication policy to the list of policies:<application-policy name="orbeon-demo"> <authentication> <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"> <module-option name="usersProperties">jboss-orbeon-example-users.properties</module-option> <module-option name="rolesProperties">jboss-orbeon-example-roles.properties</module-option> </login-module> </authentication> </application-policy>
- Open
- Optionally, you might want to setup a JDBC data source if your application is using the SQL Processor. What follows assumes you are configuring the SQL Processor with
<sql:datasource>my-datasource</sql:datasource>
.- Look at the files
JBOSS_HOME/docs/examples/jca/*-ds.xml
. You should find one that correspond to the database you are using. Copy it toJBOSS_HOME/server/default/deploy
. - Edit the file you copied and change the parameters to match your database configuration. Also assign a JNDI name to this data source with:
<jndi-name>my-database</jndi-name>
(instead ofmy-database
you might want to use a name which is descriptive of your database). - Edit
WEB-INF/web.xml
and uncomment the<resource-ref>
. Also change there the content of<res-ref-name>
to match the name you are using in the SQL Processor prefixed withjdbc/: <res-ref-name>jdbc/my-datasource</res-ref-name>
. - Edit
WEB-INF/jboss-web.xml
. In that file you should have<res-ref-name>jdbc/my-datasource</res-ref-name>
(the same name you use to configure the SQL Processor and that you have in theweb.xml
) and<jndi-name>java:/my-database</jndi-name>
(the same name you declared in the...-ds.xml
file). - Copy the JAR files with the JDBC driver for your database in
JBOSS_HOME/server/default/lib
.
- Look at the files