Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updates keystore and password locations


Info
titlePre Gradle version

This page documents the usage with Gradle, the pre-Gradle documentation is here: Apache OFBiz Technical Production Setup Guide

This page documents the trunk version, the documentation for the R16.11 version is here: Apache OFBiz Technical Production Setup Guide

NOTE: this is the technical setup guide for OFBiz, for the business oriented one, look here

Written by: David E. Jones With feedback and contributions from Jacques Le Roux, Ruth Hoffman, Andy Zeneski, Si Chen, Chris Chesney, Hans Bakker, and Al Byers

Sponsored by:
Integral Business Solutions (http://www.go-integral.com)
Hotwax Media, Inc (http://www.hotwaxmedia.com)

Table of Contents

Data To Gather for Setup

Table of Contents

Data To Gather for Setup

  1. Technical Info
    1. Host/domain name to deploy on (and ports if not 80, 443)
    2. Web server setup: direct to Tomcat/Jetty, through Apache, using another (stand-alone) application server?
    3. Which database to use.
    Technical Info
    1. Host/domain name to deploy on (and ports if not 80, 443)
    2. Web server setup: direct to Tomcat/Jetty, through Apache, using another (stand-alone) application server?
    3. Which database to use. Is the database installed on a remote server or installed locally ?

...

1) If you intend to use a development version of OFBiz, please follow the instructions on the Source Repository page to checkout the latest code or the stable branch that you require.

2) Build using "[./]ant gradlew" (add "./" on *nix systems, to use the embedded ant which is in sync with your OFBiz versionGradle which comes with its wrapper, hence gradlew and not gradle in the command). Do this from the ofbiz home directory (i.e. the directory where you installed OFBiz). Note: you can get more information about Gradle task using "gradlew tasks".

Database Setup

By default OFBiz includes and is configured for an embedded Java database called Derby. This database used to be called Cloudscape but was purchased by IBM, changed to be DB2 specification compliant, and then release as open source. This is a great database for demonstration, testing, development, and even small-scale production environments.

Expert Recommendation: We generally do not recommend the Derby database for production because it is not as easy to administer and optimize, and will generally not perform as well as more substantial or native databases. This is mainly because Derby is a lightweight Java database.

Expert Recommendation: There are many databases that OFBiz can use, both commercial and open source. While there are significant production instances of OFBiz running using Oracle, MS SQLServer, and so on, we generally recommend using an open source database such as Postgres or MySQL. Which database to use is an important decision and may have a future impacts on your implementation. If you do not have a preferred database choice then we strongly recommend discussing options with an experienced consultant before making a final decision.

  1. If you decide not to use the embedded Derby database, check/install your database of choice. See below for some information that may help with using or installing OFBiz with alternative databases

    Changing from Derby to MySQL Database
    OFBiz and Oracle
    Connecting OFBiz to PostGIS spatially enabled database
    Working with Multiple Databases

  2. If necessary, put the correct JDBC driver in the following directory:

    1. ${ofbiz install dir}/framework/entity/lib/jdbc (NOTE: You can use "download-PG-JDBC" to download the last postgres jdbc driver or  " ant download-mySQL-JDBC" to  download the last mySQL jdbc driver)
    2. Replace the old or incorrect version of the driver (i.e. copy in with same name to avoid problems with update restoring the old driver later)

  3. To setup the Entity Engine to use a different database from the default Derby database.
    In the: ${ofbiz install dir}/framework/entity/config/entityengine.xml file:
    •  Modify the "localpostgres" (or  "localmysql", "localmysqlolap" and "localmysqltenant" etc.) datasources elements to connect to your database.
    •  Modify the "default" delegator element:

          Change
              <group-map group-name="org.apache.ofbiz" datasource-name="localderbylocalderby"/>
          to
              <group-map group-name="org.apache.ofbiz" datasource-name="localmysqllocalpostgres"/>

    •     The OLAP and Tenant data sources will still use Derby. If you want to change those to use MySQL PostgreSQL also, then:

      • Modify the "localmysqlolaplocalpostgresolap" datasource element to connect to your OLAP database.

      • Modify the "localmysqltenantlocalpostgrestenant" datasource element to connect to your Tenant database.

    • Modify the "default" delegator element:

          Change
              <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
          to
              <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolaplocalpostgresolap"/>
          Change
              <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
          to
              <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenantlocalpostgrestenant"/>

    • Modify an existing datasource (near the bottom of the file) or create a new one by copying one of the sample datasources already there and giving it a new unique name
  1. If using the default OFBiz transaction manager and connection pool then update the data URI, username and password in the inline-jdbc tag

  2. If you want your OFBiz tables in a special schema you will first need to create that schema in your database and then set the schema-name attribute on the datasource tag

  3. Find the "default" delegator near the top of the file and change the datasource-name attribute value in the group-map tag under it to the name of the data source you modified or created.

Expert Recommendation: if you are using an external application server or want to setup more advanced Entity Engine configurations, see the Entity Engine Configuration Guide or other online documentation. The training videos from Undersun Consulting are highly recommend if you get into more advanced usage of OFBiz.

Initial Data Loading

To load the initial data just use the OFBiz install routine through ant gradlew or directly with Java and the build/libs/ofbiz.jar executable JAR file. By default the install routine will load the "seed" and "demo" sets of data files, as defined in the entityengine.xml file and in the ofbiz-component.xml file in each component.

Run one of the following two options from the command line in the ofbiz home directory to run the default install routine:

Code Block
ofbiz$  [./]ant run-install
gradlew loadAll (add "./" on *nix systems, to use the embedded antGradle which comes is in sync with your OFBiz version)

or

Code Block
ofbiz$ java -jar ofbiz.jar -install

help can be obtained by by the following commands:

Code Block
ofbiz$ java -jar ofbiz.jar -help

or

with its wrapper, hence gradlew and not gradle in the command). 
Do this from the ofbiz home directory (i.e. the directory where you installed OFBiz). Note: you can get more information about Gradle task using "gradlew tasks".
or
java -jar build/libs/ofbiz.jar --load-data

Help can be obtained by by the following command:

Code Block
gradlew "ofbiz -help"
or
java -jar build/libs/ofbiz.jar ?
Code Block
ofbiz$ java -jar ofbiz.jar -install -help

Note that you can choose to only load the basic "seed" data and not load the "demo" set of data files. To do this run something like:

Code Block
ofbiz$ gradlew "ofbiz --load-data readers=seed,seed-initial"
or
java -jar build/libs/ofbiz.jar -install-load-data -readers=seed,seed-initial

Definition: Seed Data is data that an application requires in order to run. It is created and maintained along with the code and should be loaded into the database when the code is updated. It should not be changed or removed in the application database without first having done so in the Seed Data XML files. In OFBiz these are the source of the Seed Data and they are maintained in the code repository along with the code. Add in components should do the same for this sort of data.

Definition: Seed Initial Data is data that is only required the first time the system is loaded like the password of the admin user. Later if you want to update the seed data, you would normally not want the password of admin to be set back to 'ofbiz'.

Expert Recommendation: For smaller installations we recommend loading the demo data and modifying it through the OFBiz applications rather than creating all of the data from scratch.

...

To load the "seed" and "ext" groups run something like:

Code Block
ofbiz$gradlew java"ofbiz -jar ofbiz.jar -install --load-data readers=seed,ext"

or the special ant target:

Code Block
ofbiz$ [./]ant run-install-extseed
(add "./" on *nix systems, to use the embedded ant which is in sync with your OFBiz version) 

The OFBiz demo data includes a Party with ID "admin" and it has a number of UserLogin accounts associated with it that have varying permissions.

or
java -jar build/libs/ofbiz.jar --load-data readers=seed,ext

The OFBiz demo data includes a Party with ID "admin" and it has a number of UserLogin accounts associated with it that have varying permissions.

Note Note the following configuration changes:

  1. For production systems the passwords on all UserLogin accounts associated with the "admin" party should be changed from their default values.
  2. The default password for the "admin" userLoginId is "ofbiz" which is also the same for the "flexadmin" and "demoadmin" accounts.
  3. The "1" account is meant to be used with the POS system so the new password should include only numbers to make it easier to use with the POS client.

...

Fresh from SVN, this file is configured to be development friendly to reload resources frequently. For production use the expire times for the caches in the last section of the file should all be commented out by putting a pound hashtag sign "#" at the beginning of each line. The properties in question start with "minilang.", "script.", "webapp.", "widget." And "template.".

...

Info

Log4J is the engine used by OFBiz to manage its log output. The releases 13.07.*, 12.04.*, 11.04.*, 10.04.* use Log4J 1 (the configuration file is named log4j.xml) while newer releases are bundled with Log4j2 (the configuration file is named log4j2.xml).

For information about advanced configuration of Log4j refer to:

...


Security Settings

${ofbiz install dir}/framework/security/config/security.properties

...

If you want the entire authentication process to fail if LDAP authentication fails, then set the security.ldap.fail.login property in ${ofbiz install dir}/framework/security/config/security.properties to true. Only users who are in the LDAP directory will be able to use OFBiz. This would be appropriate for installations that use only the back office (manager) applications.

URL and Port Settings

Info
titleVulnerabilities
 Be sure to always check the Keeping OFBiz secure page for possible vulnerabilites

URL and Port Settings

The The following configuration files contain port configuration configurations that may configured for custom OFBiz installations:.
You may also use the global portoffset Java properties. Use "gradlew "ofbiz ?" or "java -jar build/libs/ofbiz.jar -h" to know more about this option.

  • ${ofbiz install dir}/framework/base/config/ofbiz-containers.xml (The Containers Configuration File)
  • ${ofbiz install dir}/framework/webapp/config/url.properties (The URL Properties File)
    • These properties are used to configure the settings to send to the client browser. The port and host settings may be different than the port and host settings of the local machine if it is running through Apache through AJP, through any proxy, or through a load balancer of any sort. The settings in this file should be set to what the client browser will see when communicating with your system.
    • Note that the settings in this file can be overridden on the WebSite record with the ID specified by the webSiteId field in the web.xml file in each webapp, if applicable. These can be viewed and modified in the WebSites tab of the Content Manager application
    • Sometimes other container configuration files are used, but are generally in that same directory and will be specified in the start properties file used (see start.properties, pos.properties, install.properties, etc)
    • The BSH client (the last container in the file) should generally be disabled or at least protected by a firewall for production deployments. Otherwise this is a significant security risk.
    • Note that if an external application server is used instead of the embedded Tomcat or Jetty servers then many things normally configured here will be configured in the setup files for the external application server.
  • ${ofbiz install dir}/framework/webappbase/config/urljndiservers.properties (The URL Properties xml (JNDI Servers XML File)
    • These properties are used to configure the settings to send to the client browser. The port and host settings may be different than the port and host settings of the local machine if it is running through Apache through AJP, through any proxy, or through a load balancer of any sort. The settings in this file should be set to what the client browser will see when communicating with your system.
    • Note that the settings in this file can be overridden on the WebSite record with the ID specified by the webSiteId field in the web.xml file in each webapp, if applicable. These can be viewed and modified in the WebSites tab of the Content Manager application.
    ${ofbiz
    • Generally only the "default" server is used which has automatic configuration through the Java standard JNDI facility, so no changes are needed for most production deployments in this file.
  • ${ofbiz install dir}/framework/base/config/jndiserversjndi.xml properties (JNDI Servers XML FileProperties file)
    • Generally only the "default" server is used which has automatic configuration through the Java standard JNDI facility, so no changes are needed for most production deployments in this file.
    ${ofbiz install dir}/framework/base/config/jndi.properties (JNDI Properties file)
    • This is a standard Java JNDI This is a standard Java JNDI configuration properties file and is used to configure the local JNDI server to be used. Note that this is how the "default" JNDI server in the JNDI Servers XML File is configured. If this file is not present the Java standard JNDI classes will use various defaults instead.

...

  • ${ofbiz install dir}/framework/webapp/config/fop.xconf (FOP configuration file)
    • the default settings in this file can remain unchanged for production deployments, but you may need to change the "base" element (the default value is "http://localhost:8080") to point to the modified base url (it is used by FOP to resolve relative paths, e.g. to images) .

...

  • To ease development (Out Of The Box, OFBiz is configured in development mode) the compressHTML properties in general.properties if OFF. If you prefer to strip unnecessary whitespace from HTML output you can set it on ON (uncomment the line "#compress.HTML=true"). Note that non html output screens like for example tab delimited exports can be then messed up. Note also that , it is NOT the same thing as gzipped HTTP 1.1 compression.
  • For the same reason (development mode) the line "widget.verbose=true" is uncommented. If you do not want to see any informations about widget boundaries in the generated HTLM code, you should comment this line.

Ports, Default Values

  • HTTP Admin Port - 808010523
    • Configured in: ofbiz-containers XML start.properties File
    • Referenced in: Config.java File
  • HTTP - 8080
    • Configured in: ofbiz-containers XML File
    • Referenced in: Service Engine Service Engine XML File, Client Browser (if running direct), URL Properties File
  • HTTPS - 8443
    • Configured in: ofbiz-containers XML File
    • Referenced in: Client Browser (if running direct)
  • AJP13 - 8009
    • Configured in: ofbiz-containers XML File
    • Referenced in: Apache mod_jk plugin configuration
  • JRMP (JNDI, RMI, etc) - 1099
    • Configured in: Carol Properties (carol.jrmp.url)
    • Referenced in: Containers XML File, JNDI Properties File, Service Engine XML File
  • BSH Client - 9989, 9990 (this should generally be disabled or at least protected by a firewall)
    • Configured in: ofbiz-containers XML File
  • Multicast ports - 45564, etc. (Tomcat clustering)
    • Configured in: ofbiz-containers XML File

...

What is your first and last name?
[Unknown]: www.mydomain.com (example)

What is the name of your organizational unit?
[Unknown]: Undersun Testing (example)

...

What is the two-letter country code for this unit?
[Unknown]: US (example)

Is CN=www.mydomain.com, OU=Undersun Testing, O=Undersun Testing, L=New York, ST=New York, C=US correct?
[no]: yes

...

4. Download your certificate from the signing authority. Please remember to download the Certificate in PKCS#7 format. If you get a certificate in pem format don't convert to PKCS#7/P7B Format but der format

5. Import the Certificate into the keystore by running:

"keytool -import -alias ssl -trustcacerts -file mysignedcert.cer -keystore [keystore name]"

6. Configure the the framework\catalina\ofbiz-containerscomponent.xml file to point to your new keystore and password:

...

If you are having trouble getting OFBiz to connect to your mail server, try disabling your anti-virus software (temporarily) as it may block attempts to send emails from unknown applications because it thinks they are being sent by a virus.

Mounting a Root WebApp

Another possible issue is the presence in database of SystemProperty data that could overload general.properties configuration. Be sure to check the absence of mail property in SystemProperty table.

Mounting a Root WebApp

It is often desirable to have one of the webapps mounted on the root. It is often desirable to have one of the webapps mounted on the root. This is often either the ecommerce webapp or your own web site, which is created as a webapp in an OFBiz component would be setup the same way.

  1. To set the mount point to root (or "/") for a webapp, find the corresponding "webapp" tag in the appropriate ofbiz-component.xml file and change the "mount-point" attribute on that tag to equal "/".
  2. For the default OFBiz ecommerce webapp, this is found in the file:

...

There are various ways to run OFBiz, and they all come down to some variation of the executing the "build/libs/ofbiz.jar" executable JAR file.

On the command line this can be as simple as :

Code Block
ofbiz$ java -jar ofbiz.jar

or through ant(but beware you might need to pass specific JVM arguments, like "-server" if you develop on Windows, see

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyOFBIZ-7321
):

Code Block
ofbiz$ [./]ant run
(add "./" on *nix systems, to use the embedded ant which is in sync with your OFBiz version) 
gradlew ofbiz
or
java -jar build/libs/ofbiz.jar

To access the application from your browser follow advice To access the application from your browser follow advice given in the Demo and Test Setup Guide


For production use you will want to setup a start script that contains special settings for things like memory heap size, and so on. There are example start and stop scripts in the root ofbiz directory in the startofbiz.sh and stopofbiz.sh files.

...

To run all automated tests use the following command:

Code Block
ofbiz$gradlew testIntegration
or
java -jar build/libs/ofbiz.jar -testt

To run just the tests for one component run something like (for the entity component):

Code Block
ofbiz$ javagradlew "ofbiz --test component=entity"
or
 java -jar build/libs/ofbiz.jar --test -component=entity

Performance Monitoring and Tuning

...

Database Intensive Operations
The comments above on memory settings, caches, etc. are for category browsing pages and such where just about everything should be cached. For database intensive operations, like the product searching, it's much better to focus on how the database is managing with the queries.

POS Setup Process

The Point-Of-Sale (POS) component in OFBiz is still maturing, but is already a very flexible and capable enterprise class POS solution that features:

  • templated receipts
  • XML file configurable screens
  • jPOS hardware support
  • multi-tiered synchronization of product, price, promotion, party, order, and other data related to POS deployment and operation

The POS system is designed to run with its own database in a totally stand-alone mode. This was done so that even if the machine is totally cutoff from the network it can still operate. It can also be used with a shared database, for instance if you want to run a webstore simultaneously using the same stock. You could even use the same machine to run both (ERP&eCommerce + POS) using the -both parameter (see below.)

To run OFBiz in the POS "mode" just run:

Code Block
java -jar ofbiz.jar -pos

or currently on Windows use startofbizPos.

Note that this uses the pos-containers.xml file instead of the ofbiz-containers.xml file and by default it doesn't load a web container (Tomcat by default), but you may also run the command below which uses the both-containers.xml allowing to run the POS concurrently with Web eCommerce and Back Office.

Code Block
java -jar ofbiz.jar -both

or currently on Windows use startofbizBoth.

The Store for the POS needs slightly different settings than for a web store. There is an example POS Store in the demo data. One of the differences to note is that the POS Store should always have the Is Immediately Fulfilled field set to 'Y', whereas for an online store or other store types (e.g. mail, phone etc) it should be set to 'N'.

The POS Store should also have Manual Auth Is Capture set to 'Y', and typically Check Inventory and Require Inventory should be set to 'N'.

There are many files under the specialpurpose/pos directory that you may want to customize as you set it up.

  • The receipt templates stored as  .txt files in the config directory there.
  • The screens are configured through XUI in various files under the screens/default directory. There is a default set for 1024x768 screen (in default directory), and a 800x600 preset. (NOTE: To use 800x600, you must modify 3 properties in xpos.properties : StartClass, ClientWidth and ClientHeight, but don't touch the other parameters...)
  • Button events are configured in the config/buttonevents.xml file.
  • The POS is translatable, see the config directory and for more the OFBiz-POS page

You may want to change some default options following your needs.

  • In the parameters.properties file
    • By default the POS uses a virtual alphanum keyboard and a virtual numeric pad. If you prefer to use a real keyboard, change the ShowKeyboardInSaveSale parameter. (Note: You may even swap dynamically back and forth from the Admin Panel using "Virtual" button. But then the parameter will not persist.)
    • There is a related special parameter SwipWithCard which is, for now, used only to swipe card numbers using an MSR in the Client Profile dialog box (Promo Panel, Client Profile button). There are also sentinel parameters for setting MSR types.
    • If you use an external system for credit card payments then you may find it convenient to use the PosRefNum parameter which allows you makes entering payments references optional (i.e. so you dont have to enter them)
  • In pos-containers.xml and both-containers.xml (depending if you use one or the other)
    • xui-session-id : the POS terminal identifier (used during synchronisation for instance)
    • facility-id : related to the name you set for your facility on the ERP side
    • look-and-feel : see http://www.jgoodies.com/
  • In xui.properties (in framework/guiapp/config)
    • # isSameLogin : if equals "true" (false by default), a logged off user (blocked, time out, ...) can only log in with the same login/pwd.
  • There are also some technicals barcode scanning related parameters in jpos.properties

The localisation is done dynamically using the platform default. But it needs a 1st launch to be set (it dynamically changes the XUI's xpos.properties file). So in order to switch from a language to an other you have to load the POS twice  It also takes care of possible font issues. But for now only for Chinese (it uses posstyles_zh.xml).
You may override this behavior (for instance to test) using

  1. The languageSuffix parameter in the xui.properties file. This has an influence on the labels from XuiLabels.properties files.
  2. Forcing the JVM language using "-Duser.language=zh -Duser.country=CN" from the command line. This has an influence on the labels from PosUiLabels.xml file.

There are example synchronization settings in the data/PosSyncSettings.xml file, which is just an Entity Engine seed data file that gets loaded into the database.

This example is for 3 tiers: a Main Central Server (MCS), a Per-Store Server (PSS) and the Point-Of-Sale client (POS). There are example sync settings to do 4 data moves including MCS -> PSS, PSS -> POS, POS -> PSS, and PSS -> MCS.

This uses the Entity Synchronization service in the Entity Engine and the XML import file for this has pretty good comments about what does what. Note that the services shown in the example are configured to use the location "entity-sync-rmi" which is a pre-defined location specified in the serviceengine.xml file. Note that to help avoid duplication of sequenced IDs in the data that is synchronized up the chain from the POS terminals a unique prefix should be setup for the Entity Engine using the sequenced-id-prefix attribute of the delegator element in the entityengine.xml file.

Note that OOTB the login/pwd are 1/1 (or 2/2 for a non manager person) and you must open the register before being able to play with the POS.

To open the register

  1. Click on the MGR button on the top and near the right
  2. and then on the "Open" button on the right side of the screen near the top.

If you need to do some JavaPOS settings you may find this page interesting

If you need more informations see the OFBiz-POS page