Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Made setup of prices including VAT in e-commerce more explicit

This page is intended to be the root of Cookbook, FAQ, Tips, Tricks, HowTo, etc.
You may find supplementary useful informations at Old OFBiz wiki and Opentaps's OFBiz cookbooks part but not note that this information may be outdated...

Tip
titleTips
Tip

Tables of content

  • If you are looking for something that is not in the links below, try to do a search on this page. Sometimes people add a page under this one without putting a link to it. If you are in luck, the word you search is in the title of one of these pages... A better way might be to simply use the OFBiz wiki search ...

Tables of content

Table of Contents
maxLevel3
minLevel2


...


Accounting

Apache HTTPD (Apache Web server)

Ajax - Javascript - Json

Applications server

Asset Maintenance

Audit

Asset Maintenance

Audit

Barcodes

...

...

CMS

CSS

DataBase

Development tips

Development tips

Eclipse

Eclipse IDE

Geographic Geographic Information Systems (GIS)

Google

Groovy

Licences

Miscellaneous

Intellij IDEA IDE

Known issues

Licences

Load Balancing

Migration

Miscellaneous

Netbeans

Password Management

Payment

POS (the POS is deprecated and has been put in Attic)

...

Quick Start Guides

RMI

  • This RMI error on client side?, click to see the tip

    Code Block
    
    Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale en_US
    



Reporting tools

...

Selenium

Soap / XML-RPC / REST

Attachments

  • How to use SOAP in OFBiz

    Another approach deprecated since r892712
    For those who are familiar with Spring, you may be interested by Apache CXF instead of AXIS2. You will find a quick comparaison between AXIS2 and CXF here deprecated since r892712r89271

    SSL

    ...


    Themes

    Translation

    Unsubscribe

    • To unsubscribe You certainly forgot how you subscribed, it's easy to forgot if you use a Nabble forum to subscribe.

    Windows

    Workflow Engines

    XSL:FO (FOP)

    ZK (work in progress)

    A tuto (screencast) for a ZK view handler

    ...

    There is also this tuto but from comments in user ML we recommend rather the way above

    FAQ - TIPS - Cookbook - How to

    ...

    Anchor
    HTTPD
    HTTPD

    How to use mod_proxy_ajp

    You need to use a 2.2+ version of HTTPD. I used 2.2.6.

    In httpd.conf (or in a file in sites-available on Debian/Ubuntu using a2ensite)

    Uncomment (or compile with at least these modules using --enable or on Debian/Ubuntu use a2enmod)

    Code Block
    
    #LoadModule proxy_module modules/mod_proxy.so
    #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
    #LoadModule ssl_module modules/mod_ssl.so
    

    ...

    Add something like

    Code Block
    
    ProxyRequests Off
    
    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
            Allow from all
    </Proxy>
    
    # Enable/disable the handling of HTTP/1.1 "Via:" headers.
    # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
    # Set to one of: Off \| On \| Full \| Block
    ProxyVia On
    
    NameVirtualHost *:80
    
    <VirtualHost *:80>
        #   General setup for the virtual host.
        ServerName www.example.com:443
        ServerAdmin you@example.com
    
        ProxyRequests Off
        ProxyPreserveHost On
        proxyPass / ajp://localhost:8009/
    
        RewriteEngine On
        RewriteRule ^/(images/.+);jsessionid=\w+$ /$1
    
    </VirtualHost>
    
    include conf/httpd-ssl.conf
    (or include ../apache2/httpd-ssl.conf if using a file in sites-available on Debian/Ubuntu using a2ensite)
    

    In httpd-ssl.conf

    replace (according to your setup, ie. keeping the right pathespaths)

    Code Block
    
    <VirtualHost _default_:443>
    
    #   General setup for the virtual host
    ServerName www.example.com:443
    ServerAdmin you@example.com
    

    by

    Code Block
    
    <VirtualHost *:443>
        ServerName www.example.com:443
        ServerAdmin you@example.com
    
        ProxyRequests Off
        ProxyPreserveHost On
        proxyPass / ajp://localhost:8009/
    
        RewriteEngine On
        RewriteRule ^/(images/.+);jsessionid=\w+$ /$1
    
    

    for

    ...

    apache

    ...

    3.2.2

    ...

    servers

    ...

    youu

    ...

    need

    ...

    to

    ...

    add

    Code Block
    
    
        SSLEngine on
        SSLProtocol all -SSLv2
         SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
         SSLCertificateFile /etc/pki/tls/certs/localhost.crt
         SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
    ofcourse if you have a certificate for your domain you should replace
    the crt and key files of your domain files.
    
    

    It should work. On Windows the configuration is the same.
    Don't forget to edit ofbiz-containers.xml and url.properties file (change 8080 to 80 and 8443 to 443).

    ...

    Sometime it is useful to let Apache Web Server to serve the static resources such as images, css, js etc for performance or other reasons.
    In that scenario, you will need to mount the individual OFbiz OFBiz application. For example:
    Mounting Ofbiz OFBiz application as show below will forward every request to Ofbiz OFBiz including request for static resources such as images.

    Code Block
    
    proxyPass / ajp://localhost:8009/
    

    To mound individual application, use the below mentioned method. You will need to do this for all your application accept the one you want to be served by Apache Web Server e.g. /images

    Code Block
    
    <Location /accounting/>
           ProxyPass ajp://localhost:9009/accounting/
     </Location>
    

    Configure the Images folder in the Apache as shown below:

    Code Block
    
    <Directory /var/www/xxxx/images/>
           Options Indexes FollowSymLinks
           AllowOverride None
           Order allow,deny
           allow from all
        </Directory>
    

    ...

    I you need to use an svn repository on the same server the tip is to add

    Code Block
    
    proxyPass /svn !

    just before

    Code Block
    
    proxyPass / ajp://localhost:8009/

    in the 443 VirtualHost. This will give acces to your svn repsoitory (supposed to be declared as <Location /svn>) only through https. If you need also access through https, do the same in the 80 VirtualHost.

    Anchor
    fieldTypeInDerby
    fieldTypeInDerbyfield type in Derbyfield type in Derby

    Change a field type in Derby

    1. Export the table to xml
    2. Drop the table
    3. Start OFBiz - table recreated with new structure
    4. Import xml data from #1

    Advice from Adrian Crum.

    Anchor
    SQuirrel
    SQuirrel

    Browse a Derby database and more using SQuirrel

    http://db.apache.org/derby/integrate/SQuirreL_Derby.html#N101C7
    For the URL use something like jdbc:derby:c:/ofbiz/runtime/data/derby/ofbiz (of course using your right path)

    Link from Sundeep Ray. There is an alternative to this solution : Running and Debugging OFBiz in Eclipse#Connectingthedatabase Browsing Derby Database in Eclipse

    Anchor
    cvv codes
    cvv codes

    Use CVV (also called CV2 and more acronyms) codes in OFBiz

    As of rev. 585172 (date 2008-10-16) the changes mentioned below have been officially included in the OFBiz trunk.

    https://issues.apache.org/jira/browse/OFBIZ-767#action_12476855

    Anchor
    gift card
    gift card

    Using gift-card in OFBIz

    Steps to use GC with OFBiz demo data:
    After you create GC for a party(e.g for DemoCustCompany) with
    Card Number: 12345 and Pin Number:123, then:

    • Create Financial Account:

    ...

    ...

    ...

    ...

    ...

    • 10000 (you might need to use you own finAccountId)
      Fin Account Trans Type Id = Deposit
      Amount = 1000 (this amount should be grated that the order total)

    After that Fin Account available balance will be 1000. You can check this here:
    httpshttp://demo-trunk-ofbiz.ofbizapache.org/accounting/control/EditFinAccount?finAccountId=10000 - field "Available Balance".

    ...

    A tip from Rashko Rejmer


    Anchor
    PatchingOnWindows
    DisablingBrowserCachePatchingOnWindowsDisablingBrowserCache

    Ajax : Disable Browser Cache for Module

    http://docs.ofbiz.org/x/CAo

    A tip from Krzysztof Podejma

    ...

    Patch on Windows

    Creating patches
    • Using Eclipse => Subclipse (Create Patch, Apply Patch context menu options, the clipboard one is the "easiest")
    • Using ToirtoiseSVN from Files Explorer (Create Patch, Apply Patch context menu options).

    ...

    Ajax : Integrate OFBiz with Yui-Ext

    http://www.nabble.com/Re%3A-integrate-OFBiz-with-Yui-Ext-p11131937.html

    A tip from Jason Wu

    ...

    Patch on Windows

    Creating patches

    • Using Eclipse => Subclipse (Create Patch, Apply Patch context menu options, the clipboard one is the "easiest")
    • Using Toirtoise from Files Explorer (Create Patch, Apply Patch context menu options). Tortoise does not exist on Linux/Mac but there are some equivalent tools.
    • Making a diff with subversion on command line : svn di fileName > filename.patch

    I let you find the tools with google :Eclipse/Subclipse, Tortoise, Subversion client, patch.exe, todos.exe, etc.

    Applying patches
    Tip

    Note that below no longer works (or hardly) since Windows 7. I suggest rather to use Cygwin if you use a version below WIndows 10. I have personnaly installed with Git Bash. Bash comes embedded with WIndows 10.

    To patch on Windows you To patch on Windows you have to download patch.exe. But you may encouter EOL problems with patch.exe. That's why I prefer to use Eclipse's "Apply Patch" option wich is great to use with clipboard. If you get issue with Subclipse and work on Windows you may try Tortoise's "Apply Patch" option. If I get problems with Tortoise I then use the patch command. Something to understand is that Tortoise actually use "SVN merge" so in certains cases problems arise. To avoid EOL problems with the patch command, I use a bat file patchdos.bat :

    Code Block
    
    todos %1
    patch -N -p0 < %1
    

    ...

    Anchor
    WindowsService
    WindowsService

    Run OFBiz as a Windows service

    • You need JavaService.exeThis is freely available at http://javaservice.objectweb.org/.
      Documentation and example code are also available
      Unzip the JavaService-bin-1.2.x.zip (or JavaService-2.0.x.zip)
    • Where should the expanded files be located?
      Set up and run your script with the appropriate path. Ex:

      Code Block
      
      javaservice -install OFBiz %java_home%\jre\bin\server\jvm.dll -Xms256M -Xmx512M
      -Djava.class.path=%java_home%\lib\tools.jar;%ofbiz_home%\ofbiz.jar
      -start org.ofbiz.base.start.Start
      -out %ofbiz_home%\logs\serviceLog.txt
      -err %ofbiz_home%\logs\serviceErr.txt
      -current %ofbiz_home%
      -manual
      



      Note: If your java sdk is installed under a directory with a space in it, the service will install, but not start properly, unless you change java_home to the DOS 8.3 name. For example, if your java sdk is installed in C:\Program Files\Java\j2sdk1.4.2_xx then you would set java_home=C:\PROGRA~1\Java\j2sdk1.4.2_xx* Go to the win2k services app and you should now find a service 'OFBiz' set up to run manually (this of course can be changed to run automatically if so desired).


    • Alternatively, the service can be started with the command:net start OFBiz
    • And the service can then be stopped with the command:net stop OFBiz

    ...

    Anchor
    SomeSeleniumTips
    SomeSeleniumTips

    Some Selenium tips

    Brett Palmer gave a presentation on Selenium testing for Ofbiz at ApacheCon 2008. The presentation is no longer available at the ApacheCon site, but is available at http://www.kenfuse.com/forum/material-regarding-seleniumxml.

    Setting up Selenium RC server in Windows

    1. Download latest version of Selenium RC and extract in a folder named Selenium at (for instance) C:\Program Files\Java\jdk1.6.0_03\bin
    2. From Command prompt run the following commands:
      • cd C:\PROGRA~1\Java\jdk1.6.0_03\bin
      • java -jar .\Selenium\selenium-server.jar -interactive

    If you see the following messages at the end of the console, the Selenium server is running fine:
    Entering interactive mode... type Selenium commands here (e.g: cmd=open&1=http://www.yahoo.comImage Removed)

    Below is deprecated but may still contain useful tips. Else rather see and follow Selenium in Webtools...

    ...

    Here an example based on one of my test (http://labs.libre-entreprise.org/scm/viewvc.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestCreateNomenclature.html?revision=1.10&root=neogia&view=markup)

    Code Block
    
    <!-- create a variable named uid that contains an unique identifier -->
    <tr>
           <td>store</td>
           <td>javascript{(new Date()).getTime() % 10000}</td>
           <td>uid</td>
    </tr>
    



    Code Block
    
    <!-- use of the variable named uid to fill a form entry -->
    <tr>
           <td>type</td>
           <td>partyId</td>
           <td>user-${uid}</td>
    </tr>
    

    3) What is the difference between click and clickAndWait ? I would like to understand why I'm getting different behaviors from click and clickAndWait functions. Here is the scenario: I want to perform the login and then verify some text on the page (what should be pretty straight forward...) My first approach was using the clickfunction + pause function. Something like below:

    Code Block
    
    <tr>
        <td>click</td>
        <td>submit</td>
        <td></td>
    </tr>
    <tr>
        <td>pause</td>
        <td>3000</td>
        <td></td>
    </tr>
    

    The approach above worked fine and I was able to proceed with my test. However, I was looking the clickAndWait functionality and, per my understanding, this function should have a simlar behavior to my code above.. then I wrote the following:

    Code Block
    
    <tr>
        <td>clickAndWait</td>
        <td>submit</td>
        <td></td>
    </tr>
    

    ...

    I think the right solution is to use clickAndWait command instead of click+pause because it always success contrary to click+pause (we dont known the page response time). I see no reason why you don't observe the same behavior with clickAndWait. Maybe it's because your are testing the login page that can be a little tricky to test due to the session handling.
    To be sure to always start a test in a clean session, my tests always do the same actions :
    1. logoff
    2. login
    3. check error
    Here, an example of my standard login procedure under selenium from (http://labs.libre-entreprise.org/scm/viewvc.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestCreateNomenclature.html?root=neogia&view=markup)

    Code Block
    
    <!-- Begin of standard login procedure -->
    <tr>
     <td>open</td>
     <td>/manufacturing/control/logout</td>
     <td></td>
    </tr>
    <tr>
     <td>type</td>
     <td>USERNAME</td>
     <td>admin</td>
    </tr>
    <tr>
     <td>type</td>
     <td>PASSWORD</td>
     <td>ofbiz</td>
    </tr>
    <tr>
     <td>select</td>
     <td>locale</td>
     <td>value=fr</td>
    </tr>
    <tr>
     <td>clickAndWait</td>
     <td>submitButton</td>
     <td></td>
    </tr>
    <tr>
     <td>assertElementNotPresent</td>
     <td>//div[@class='errorMessage']</td>
     <td></td>
    </tr>
    <!-- End of standard login procedure -->
    

    ...

    Anchor
    NativeDatabaseTip
    NativeDatabaseTip

    How to troubleshoot SQL Errors

    If you receive an SQL error in ofbiz, it doesn't show the error from the database itself. Instead, it shows a general error which isn't neccessarily clear. Run the SQL directly on the database get a more helpful error message.


    Anchor
    External DatabaseReadOnlyDatabaseExternal Database
    ReadOnlyDatabase

    How to connect to

    ...

    a Database

    ...

    on read only

    If you need to connect OFBiz to a database without write access or you want just are sure that your users have a read acces, you can change on the entityengine.xml the helper to the class ReadOnlyHelperDAO on your data-source  like that

    Code Block
    languagexml
        <datasource name="localderby"
                helper-class="org.apache.ofbiz.entity.datasource.ReadOnlyHelperDAO"
                schema-name="OFBIZ"
                field-type-name="derby">...


    Anchor
    External Database
    External Database

    How to connect to an External Database

    1. Create entity definitions for the external database like you would for an OFBiz entity (except use the no-auto-stamp="true" attribute).
    2. Assign the entities to a different group (in entitygroup.xml), "myExternalDB" for example.
    3. Create a datasource for the external database (in entityengine.xml), named "myExternalDB" for example.
    4. Assign the "myExternalDB" datasource and the "myExternalDB" entity group to the the default delegator: <group-map group-name="myExternalDB" datasource-name="myExternalDB"/>
    5. Use the default delegator to access the external database.

    Anchor
    SendingMailsToContactLists
    SendingMailsToContactLists

    Sending mails to contact lists

    In the marketing application, click on contact list, then find your list, then click on Comm Events and then Create New Contact List. Comm

    1. Create entity definitions for the external database like you would for an OFBiz entity (except use the no-auto-stamp="true" attribute).
    2. Assign the entities to a different group (in entitygroup.xml), "advertpro" for example.
    3. Assign the "mysql-advertpro" datasource the the default delegator: <group-map group-name="myExternalDB" datasource-name="myExternalDB"/>
    4. Use the delegator to access the external database.

    ...

    Sending mails to contact lists

    In the marketing application, click on contact list, then find your list, then click on Comm Events and then Create New Contact List. Comm Event should land you here:
    httpshttp://demo-trunk-ofbiz.ofbizapache.org//marketing/control/EditContactListCommEvent?contactListId=9000&DONE_PAGE=/marketing/control/ListContactList

    based on the trunk demo server.

    ...

    Anchor
    ImportCustomisedData
    ImportCustomisedData

    How to save customised data for import as demo data

    Add a entity-resource entry of type "data" and reader-name as "ext" in ofbiz-components.xml of your application. For example:

    Code Block
    
    <entity-resource type="data" reader-name="ext" loader="main" location="data/GeoData_IN.xml"/>
    

    And run the

    Code Block
    
    "run-install-extseed"
    

    ant target instead of

    Code Block
    
    "run-install"
    

    This should load your modified data along with the seed data and without any demo data.

    Anchor
    appservercreateAcctgTransAndEntriesappserver

    How to run inside a non embedded application server

    Have a look at framework/appserver/README file. You might be also interested by Run OFBiz under outside Application Servers (WASCE 2.0.0.1, Geronimo 2.0.3, Tomcat 5.5 and 6, JBoss 4.2.2)

    ...

    createAcctgTransAndEntries

    Issue with createAcctgTransAndEntries service

    If

    ...

    Issue with createAcctgTransAndEntries service

    If you see errors like

    Error:Error trying to begin transaction, could not process method: The
    current transaction is marked for rollback, not beginning a new
    transaction
    and aborting current operation; the rollbackOnly was caused by: Service
    createAcctgTransAndEntries threw an unexpected
    exception/errororg.ofbiz.service.ServiceValidationException: The following
    required parameter is missing: OUT
    createAcctgTransAndEntries.acctgTransId (The following required
    parameter
    is missing: OUT createAcctgTransAndEntries.acctgTransId) calling
    service
    balanceInventoryItems in receiveInventoryProduct

    ...

    Anchor
    BestPracticeModifyOrCreate
    BestPracticeModifyOrCreate

    What is the best practice to modify an existing component or create a new one?

    From an old thread by Chris Howe and David Jones. Note that it's now easier to use the create-component ant target (just try "ant -p" to know more) or the Gradle createComponent Gradle task for newer project.

    Chris Howe: Lets say that I want to create an application that most closely matches the ecommerce app. I should start with copied versions the following files only.

    Code Block
    
    ofbizhome/speciapurpose/myapp/build.xml
    ofbizhome/speciapurpose/myapp/ofbiz-component.xml
    ofbizhome/speciapurpose/myapp/webapp/myapp/WEB-INF/controller.xml
    ofbizhome/speciapurpose/myapp/webapp/myapp/WEB-INF/web.xml
    ofbizhome/speciapurpose/myapp/webapp/myapp/index.jsp
    

    ...

    Anchor
    BestPracticeCustomWebApp
    BestPracticeCustomWebApp

    What is considered the best practice in creating a custom web application with OFBIZ?

    A David Jones's tip

    One approach is to simply copy an entire component into a new directory and start hacking away at it until it fit your needs. This is a fine practice if you never have plans of bringing it up to date with a current revision or version. OFBIZ is currently making about 40 commits a week. By the time you complete your customizations, you are out of date.

    ...

    Which one is right? It depends on on how much changes you are making. Modifying the following files will allow you to "customize" an application, whereas starting from scratch using an existing application as a template is better for a "custom application."

    The Five Files

    • application\...\webapp\...\WEB-INF\controller.xml
      • <web-app>
        • change the <display-name>
        • change the <description>

    ...

    Now if you were to start OFBIZ and point your browser to mydomain.com/myapp you would see an exact duplicate of the application that you were modeling.

    ...

    The goal with the differences app is to create all of the customizations that you need without touching original OFBIZ code. That way when you update to more current versions, you're less likely to encounter significant conflicts. It makes your application close to being "turn-key".

    The Decorator

    Most likely the first thing your're going to want to customize is the decoration (the header, which screens are in the leftbar if you want to display a right bar, how the body is displayed, which UILabels you use, etc). For this you need to do two things. (As of revision 5539 you can only do this if your views are using the ecommerce application, it shouldn't be long before all of the applications support this)

    • Change the location of the mainDecoratorLocation in web.xml

      Code Block
      
      <context-param>
          <param-name>mainDecoratorLocation</param-name>
          <param-value>component://ecommerce/widget/CommonScreens.xml</param-value>
          <description>The location of the main-decorator screen to use for this webapp; referred to as a context variable in screen def XML files.</description>
      </context-param>
      



    • Create a screen with name="main-decorator" in the file you specified in the mainDecoratorLocation property (I imagine you'll want to copy an existing decorator screen and modify it rather than start from scratch)

    Now your application is an exact copy of the model application with your customized decoration. The reason it's an exact copy is because you have essentially the same controller.xml files in both applications. All of the requests call the same views, which call the same screens, which in turn call the same actions and widgets. So now you want to make some more changes.

    Customize Screens

    • controller.xml
      • <view-map>
        • change the name if necessary
        • change the location to a *Screens.xml file inside custom application
    • Screens.xml
      • create a new screen
      • remember they can call .bsh, .ftl, and forms from other applications
      • if you want to use a custom .ftl or .bsh be sure to us a similar directory structure as the original file so you can make easy comparisons when you update.

    ...

    That's really all there is to it. If you call new services from the requests, make sure you create your file in component://myapp/servicedef/services.xml and make sure it gets loaded in the ofbiz-component.xml file. Same with ECAs. Need new classes, create them in your src directory and don't forget to build them with ant. Keep in mind two things and maintanence maintenance of your custom application will be easier and less error prone.

    ...

    Anchor
    ExtendExistingComponent
    ExtendExistingComponent

    How to Extend an

    ...

    Existing Component

    Scenario: For any customized application under hot-deploy if it is needed to extend the existing component then changes in following files are required.(For instance You can extend any of the existing applications via a custom component in the hot-deploy directory.  In the following example we are extending the Marketing component via our custom component called mycomponent.)
    1) Inside webapp of your customize application create a folder for component name. (marketing/WEB-INF)
    2) Add controller.xml, web.xml
    3) In controller.xml file include the <include location="component://marketing/webapp/marketing/WEB-INF/controller.xml"/>
    4) In ofbiz-component.xml (hot-deploy/customize_project/)
    add following code :
    <webapp name="marketing" title="Marketing-Customized" server="default-server" location="webapp/marketing" base-permission="OFBTOOLS,MARKETING" mount-point="/marketing"/>
    (extending marketing component here.) Now here the basic setup for extend the component is completed, now you can add component specific request and view in controller.xml here. And create screens in the extanded componint. Note : Please add if some of the information is missing here. AnchorHowToSetSSLHowToSetSSL

    Configuring SSL

    There are two main techniques in configuring SSL, through Apache (recommended), and through the JVM directly.

    Apache

    Configuring SSL through Apache is probably the preferred method, and is well documented.

    JVM

    It's also possible to have the SSL certificate in your JVM environment. The certificate is usually found in the $JAVA_HOME/jre/lib/security directory.

    The default file that ships with OFBiz is called cacerts.

    You will need to use the Java keytool utility to add certificates from other SSL sites (e.g. www.mywebsite.com) . Here is a pretty good tutorial on getting your SSL certificate setup

    The basic steps are described here

    Getting an SSL Certificate

    Here are some Certificate vendors (this list is from 2005)

    • Verisign
    • Thawte - Thawte Certificate ~ $350 / 2 yrs
    • Comodo
    • GeoTrust
    • FreeSSL - Professional (Not actually Free by the way)
    • CACert.org

    ...

    Budget Plans

    ...

    • FreeSSL - StarterSSL ~ 39 per year
    • Comodo - InstantSSL (Second Tier requiring multiple Certs be installed)

    ...

    Free

    ...

    ...

    1. First we need to create a new WEB-INF folder inside your custom component's webapp directory ($OFBIZ_HOME/hot-deploy/mycomponent/webapp).  To create folders for the component you want to extend, use the name of the component you want to extend: ( OFBIZ_HOME is the location of the root directory of OFBiz)

      Code Block
      languagebash
      $ cd $OFBIZ_HOME/hot-deploy/mycomponent/webapp
      $ mkdir -p marketing/WEB-INF

      You should have the a new WEB-INF directory: $OFBIZ_HOME/hot-deploy/mycomponent/webapp/marketing/WEB-INF


    2. Create an empty controller.xml file in this new WEB-INF folder:

      Code Block
      languagebash
      $ touch $OFBIZ_HOME/hot-deploy/mycomponent/webapp/marketing/WEB-INF/controller.xml



    3. In this new controller.xml file include the controller.xml file from the marketing component:

      Code Block
      languagexml
      <?xml version="1.0" encoding="UTF-8"?>
      <site-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/site-conf.xsd">
      	<include location="component://marketing/webapp/marketing/WEB-INF/controller.xml"/>
      </site-conf>



    4. Copy the marketing component's web.xml from the marketing component's WEB-INF directory ($OFBIZ_HOME/applications/marketing/webapp/marketing/WEB-INF) into the new WEB-INF folder:

      Code Block
      languagebash
      $ cp $OFBIZ_HOME/applications/marketing/webapp/marketing/WEB-INF/web.xml $OFBIZ_HOME/hot-deploy/mycomponent/webapp/marketing/WEB-INF/



    5. In you custom component's ofbiz-component.xml ($OFBIZ_HOME/hot-deploy/mycomponent/) add following code:

      Code Block
      languagexml
      titleextending marketing component here
      <webapp name="marketing" title="Marketing-Customized" server="default-server" location="webapp/marketing" base-permission="OFBTOOLS,MARKETING" mount-point="/marketing"/>



    The basic setup for extending the component is completed.  You can add your custom component specific request and view in controller.xml.  You can add other items such as SECAs in secas.xml and have them triggered on services in the component you want to extend. You can also create screens in the extended component.

    Anchor
    HowToSetSSL
    HowToSetSSL

    Configuring SSL

    There are two main techniques in configuring SSL, through Apache (recommended), and through the JVM directly.

    Apache

    Configuring SSL through Apache is probably the preferred method, and is well documented.

    JVM

    It's also possible to have the SSL certificate in your JVM environment. The certificate is usually found in the $JAVA_HOME/jre/lib/security directory.

    The default file that ships with OFBiz is called cacerts.

    You will need to use the Java keytool utility to add certificates from other SSL sites (e.g. www.mywebsite.com) . Here is a pretty good tutorial on getting your SSL certificate setup

    The basic steps are described here

    Getting an SSL Certificate

    Here are some Certificate vendors (this list is from 2005)

    • Verisign
    • Thawte - Thawte Certificate ~ $350 / 2 yrs
    • Comodo
    • GeoTrust
    • FreeSSL - Professional (Not actually Free by the way)
    • CACert.org

    ...

    Budget Plans
    • FreeSSL - StarterSSL ~ 39 per year
    • Comodo - InstantSSL (Second Tier requiring multiple Certs be installed)
    Free

    Anchor
    RMI-Error-on-client
    RMI-Error-on-client

    RMI error on client side

    Add the $OFBIZ/framework/base/config dir to the jar as a <resource> in your build file (Maven's pom.xml example, to be adapted for ant)

    Code Block
    <resources>

    ...

    RMI error on client side

    Add the $OFBIZ/framework/base/config dir to the jar as a <resource> in your build file (Maven's pom.xml example, to be adapted for ant)

    Code Block
    
    <resources>
          <resource>
            <directory>../../../framework/base/config</directory>
          </resource>
          <resource>
            <directory>../../../framework/base/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/datafilebase/dtd<config</directory>
          </resource>
          <resource>
            <directory>../../../framework/entitybase/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/entityextdatafile/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/entity/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/entityext/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/minilang/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/security/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/service/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/widget/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/workflow/dtd</directory>
          </resource>
          <resource>
            <directory>../../../framework/applications/content/dtd</directory>
          </resource>
        </resources>
    

    ...

    Anchor
    HowToUseRMIWithoutSSL
    HowToUseRMIWithoutSSL

    How to use RMI without SSL

    By default, since OFBIz is under the Apache Software Fundation Licence, OFBiz comes with RMI using SSL. Before it was possible to use RMI without SSL. But due to licence constraint some code has been removed. If you need, for testing for instance, to use RMI without SSL follow this tip:
    In framework/base/config/ofbiz-containers.xml comment out this snippet during tests

    Code Block
    
    <property name="client-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
    <property name="server-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
    <property name="ssl-keystore" value="framework/base/config/ofbizrmi.jks"/>
    <property name="ssl-keystore-type" value="JKS"/>
    <property name="ssl-keystore-pass" value="changeit"/>
    <property name="ssl-keystore-alias" value="rmissl"/>
    <property name="ssl-client-auth" value="false"/>
    

    OR

    1. In framework/base/config/ofbiz-containers.xml replace (or better comment out during tests)
      Code Block
      
      <property name="client-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
      <property name="server-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
      
      by
      Code Block
      
      <property name="client-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/>
      <property name="server-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/>
      <property name="ssl-client-auth" value="false"/>
      
    2. Unzip in framework\service\src\org\ofbiz\service\rmi\socket\zip the content of this attachment

    ...

    How to test easily if RMI is working (using a simple client)

    Simply run the testRmi service from Webtools (not sure this is sufficient...)
    OR
    Unzip somewhere on you disk this attachment. From there I guess it's pretty simple.

    ...

    Somethings you should know about RMI

    • On Windows, do not have any spaces between any directories on your path, or the RMIDispatcher will not start
    • On Linux, the RMI server may not know its own IP address and might get "lost." This will cause java.net.SocketException?: Socket is not connected (Error connecting to 127.0.0.1). This error message is generated on the RMI server but it will be displayed on the RMI client. The answer is to force rmi server's IP address into the JVM environment.

    For that simply uncomment these lines in startofiz.sh

    Code Block
    
    IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
    RMIIF="-Djava.rmi.server.hostname=$IPADDR"
    
    • Here's another little tidbit, if the -Djava.rmi.server.hostname isn't working and the exception is still being generated on the client (from the server) on linux try changing the order of the host names in the /etc/hosts file so that the 127.0.0.1 appears last. This is apparently due to a bug in the InetAddress.getLocalHost() method.
    • Make sure that rmiregistry is not running on your RMIDispatcher/JOTM/jndi port before starting Open for Business
    • One of the problems of using RMI is that complex objects such as GenericValues are available but entity methods on that object won't work as they require the entity engine. A workaround is to define facade services that return simple pojos. Then rmi works pretty well.

    ...

    How to manage your source differences

    The first three links use the vendor branch principle

    1. An old how to for CVS, may be adapted to SVN
    2. A more recent one for SVN
    3. A specific one for Windows

    An alternative using SVK and not the vendor branch principle : How to use SVK for creating local SVN repositories (a Vinay Agarwal'tip)

    A discussion about this topic on user ML proposing a simpler alternative way, extract :

    1. I keep two main patch files - basic_development.patch and basic_production.patch. Both patch files change the OFBiz configuration to work with our network environment, each one using settings chosen for the task - development or production. Only one patch is used at a time.
    2. I keep all of my custom development in a single folder under the ofbiz/hot-deploy folder. I avoid touching the trunk code at all costs - except for the configuration patches mentioned above.
    3. To keep my local copy updated, I do an SVN revert (to reverse the changes made by the patch), then an SVN update, then re-apply the patch. My custom development folder is untouched by the SVN commands, because SVN doesn't "know" about the folder.
      This works really well and it doesn't involve any complicated merging - since the configuration files changed by the patches seldom change in the trunk.

    Also certainly the most advanced way using *-ofbiz-patches targets from hot-deploy/vinops/build.xml

    ...

    If you get accounting related issues and are not interested in posting accounting transactions

    1. If you are not interested in posting accounting transactions to the GL then you can disable (i.e. comment out) the first eca rule in accounting/servicedef/secas_ledger.xml
      Code Block
      
      <eca service="createAcctgTransAndEntries" event="commit">
          <condition field-name="acctgTransId" operator="is-not-empty"/>
          <action service="postAcctgTrans" mode="sync"/>
      </eca>
      
    1. Configure an Error Journal to post there the accounting transactions that are incomplete
      You can create the error journal in this way:
      1. Go to Accounting >>General Ledger >>Setup >>Journals and create a new journal
        https://localhost:8443/accounting/control/SetupGlJournals?organizationPartyId=Company
      2. Go to Accounting >>General Ledger >>Setup >>Accounting Preferences and select the journal in the "Error Gl Journal Id":
        https://localhost:8443/accounting/control/PartyAcctgPreference?organizationPartyId=Company
      3. All the "incomplete" transactions will be visible here:
        https://localhost:8443/accounting/control/ListUnpostedAcctgTrans?organizationPartyId=Company

    ...

    Is it possible to delete products, categories, catalogs, etc., that are no longer needed?

    This question has been already asked many times. You should find more information in Nabble
    The main idea is that in OFBiz we don't delete but use end dates to mark obsolescence.

    Four main reasons :

    • Data are still there in case of audit
    • Disk space should not a be problem
    • DB indexes are managing quite well huge data volumes.
    • Easier with all entities associations

    If you really need to do it, think about these 4 points before...

    ...

    Show prices with VAT included in eCommerce

    For that you must :

    1. In your store, set the field "Show Prices With Vat Tax"=Y
    2. Set the field "Vat Tax Auth Geo Id" with the corresponding VAT Geo (it's a default value, remember the VAT is applied in function of the client Geo)
    3. Set the field "Vat Tax Auth Party Id" with a correctly set Tax Authority (see below how to set it in accouting)
    4. In accouting, set your Tax Authority (and any you will need)
      1. "Include Tax In Price"=Y
      2. Create the "Categories" that will include products with VAT included (this is not mandatory, it allows to limit the scope)
      3. Set the "Product Rates" you need. Note that you can Tax Promotions and Shipping if needed

    ...

    Certificate

    You need to have the ofbizrmi.jks and ofbiztrust.jks setup at both ends. For testing, the easiest way is

    • to create a certificate,
    • export it to the trust store ,
    • and then just copy both these files to the other instance.

    For production, remember that the truststore of the "client" would hold the public key exported from the keystore of the "server". Conversely the truststore of the "server" would hold the public key exported from the keystore of the "client". Making the keystore and truststore identical on both sides makes life a bit easier for testing, but make sure you toughen things up before you go into production!!!

    Thanks to Andrew Sykes

    ...

    About lastUpdatedStamp, lastUpdatedTxStamp (transaction), createdStamp, and createdTxStamp

    They are the timestamps that the entity engine automatically maintains for all entities, unless you use no-auto-stamp=true in the entity definition. But by default all entities will have these four fields.

    The transaction stamps are when the transaction was begun that the change is part of, and the stamps are within that transaction, although they are an absolute value. But to order the actual records that changed within the transaction. The entity engine does do things for these stamp fields when it maintains them, by the way, that ensure that within a transaction each updated or created stamp, depending on whether it's a create or updated, is unique for that transaction.

    So it'll keep track of the last one and always increment it by one, even if it's been less than a millisecond since the other record went through. As long as you don't have more than a thousand records going into the database per second in a single transaction then you shouldn't have problems with overflowing it too much.

    But it is important that those are unique, so we can order all the records by these stamps and basically reproduce the transaction to send it over to the other server. Even reproducing the transaction we can't always eliminate problems with foreign keys. Anyway that's the intention here, to reduce problems with foreign keys as much as possible and recreate the data changes on the remote server when the synchronization goes through

    Adapted from Advanced Framework Transcription PDF

    ...

    How are managed transactions in different currencies from the one of GL ?

    Accounting transactions originated by events in different currencies from the one of GL are automatically converted using the currency exchange rate of the date of the transaction.
    The "company base currency" is set in the partyAcctgPreference. You have to enter a record in the CurrencyUomDated entity.
    If this information is available then you'll notice that the AcctgTransEntry will have two different amounts in the fields amount/currencyUomId and origAmount/origCurrencyUomId

    The modification is done by the createAcctgTransEntry service.

    From a discussion between Jacopo and Hans on dev ML

    ...

    "/>
    <property name="ssl-keystore-alias" value="rmissl"/>
    <property name="ssl-client-auth" value="false"/>
    

    OR

    1. In framework/base/config/ofbiz-containers.xml replace (or better comment out during tests)

      Code Block
      <property name="client-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLClientSocketFactory"/>
      <property name="server-factory" value="org.ofbiz.service.rmi.socket.ssl.SSLServerSocketFactory"/>
      

      by

      Code Block
      <property name="client-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionClientSocketFactory"/>
      <property name="server-factory" value="org.ofbiz.service.rmi.socket.zip.CompressionServerSocketFactory"/>
      



    2. Unzip in framework\service\src\org\ofbiz\service\rmi\socket\zip the content of this attachment

    Anchor
    HowToTestIfRMIIsWorking
    HowToTestIfRMIIsWorking

    How to test easily if RMI is working (using a simple client)

    Simply run the testRmi service from Webtools (not sure this is sufficient...)
    OR
    Unzip somewhere on you disk this attachment. From there I guess it's pretty simple.

    Anchor
    SomethingsYouShouldKnowAboutRMI
    SomethingsYouShouldKnowAboutRMI

    Somethings you should know about RMI

    • On Windows, do not have any spaces between any directories on your path, or the RMIDispatcher will not start
    • On Linux, the RMI server may not know its own IP address and might get "lost." This will cause java.net.SocketException?: Socket is not connected (Error connecting to 127.0.0.1). This error message is generated on the RMI server but it will be displayed on the RMI client. The answer is to force rmi server's IP address into the JVM environment.

    For that simply uncomment these lines in startofiz.sh

    Code Block
    IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
    RMIIF="-Djava.rmi.server.hostname=$IPADDR"
    
    • Here's another little tidbit, if the -Djava.rmi.server.hostname isn't working and the exception is still being generated on the client (from the server) on linux try changing the order of the host names in the /etc/hosts file so that the 127.0.0.1 appears last. This is apparently due to a bug in the InetAddress.getLocalHost() method.
    • Make sure that rmiregistry is not running on your RMIDispatcher/JOTM/jndi port before starting Open for Business
    • One of the problems of using RMI is that complex objects such as GenericValues are available but entity methods on that object won't work as they require the entity engine. A workaround is to define facade services that return simple pojos. Then rmi works pretty well.

    Anchor
    SourceDifferences
    SourceDifferences

    How to manage your source differences

    The first three links use the vendor branch principle

    1. An old how to for CVS, may be adapted to SVN
    2. A more recent one for SVN
    3. A specific one for Windows

    An alternative using SVK and not the vendor branch principle : How to use SVK for creating local SVN repositories (a Vinay Agarwal'tip)

    A discussion about this topic on user ML proposing a simpler alternative way, extract :

    1. I keep two main patch files - basic_development.patch and basic_production.patch. Both patch files change the OFBiz configuration to work with our network environment, each one using settings chosen for the task - development or production. Only one patch is used at a time.
    2. I keep all of my custom development in a single folder under the ofbiz/hot-deploy folder. I avoid touching the trunk code at all costs - except for the configuration patches mentioned above.
    3. To keep my local copy updated, I do an SVN revert (to reverse the changes made by the patch), then an SVN update, then re-apply the patch. My custom development folder is untouched by the SVN commands, because SVN doesn't "know" about the folder.
      This works really well and it doesn't involve any complicated merging - since the configuration files changed by the patches seldom change in the trunk.

    Also certainly the most advanced way using *-ofbiz-patches targets from hot-deploy/vinops/build.xml

    Anchor
    PostingAccountingTransactions
    PostingAccountingTransactions

    If you get accounting related issues and are not interested in posting accounting transactions

    1. If you are not interested in posting accounting transactions to the GL then you can disable (i.e. comment out) the first eca rule in accounting/servicedef/secas_ledger.xml

      Code Block
      <eca service="createAcctgTransAndEntries" event="commit">
          <condition field-name="acctgTransId" operator="is-not-empty"/>
          <action service="postAcctgTrans" mode="sync"/>
      </eca>
      



    1. Configure an Error Journal to post there the accounting transactions that are incomplete
      You can create the error journal in this way:
      1. Go to Accounting >>General Ledger >>Setup >>Journals and create a new journal
        https://localhost:8443/accounting/control/SetupGlJournals?organizationPartyId=Company
      2. Go to Accounting >>General Ledger >>Setup >>Accounting Preferences and select the journal in the "Error Gl Journal Id":
        https://localhost:8443/accounting/control/PartyAcctgPreference?organizationPartyId=Company
      3. All the "incomplete" transactions will be visible here:
        https://localhost:8443/accounting/control/ListUnpostedAcctgTrans?organizationPartyId=Company

    Anchor
    obsolete
    obsolete

    Is it possible to delete products, categories, catalogs, etc., that are no longer needed?

    This question has been already asked many times. You should find more information in Nabble
    The main idea is that in OFBiz we don't delete but use end dates to mark obsolescence.

    Four main reasons :

    • Data are still there in case of audit
    • Disk space should not a be problem
    • DB indexes are managing quite well huge data volumes.
    • Easier with all entities associations

    If you really need to do it, think about these 4 points before...

    Anchor
    PricesIncludingVAT
    PricesIncludingVAT

    Show prices with VAT included in eCommerce (B2C)


    In order to show the prices including VAT in the store for consumers, you need to take following steps:

    1. in the accounting component:
      1. adjust the data for the appropriate Tax Authority so that 'Include Tax in Price' = 'Y'
      2. associate the appropriate product categories under the 'Categories' tab of the Tax Authority
      3. set the appropriate product rate (for Value Added Tax)
      4. optionally set the flag for 'Tax Promotions'
      5. optionally set the flag for 'Tax Shipping'
    2. in the catalog component for the appropriate store (in the section 'TAX':
      1. set the flag 'Show prices with VAT tax included' to 'Y'
      2. set the appropriate Vat Tax Auth Geo ID
      3. set the appropriate Vat Tax Auth Party ID

    For now you can't set a different VAT rate for shipping, see last comment of

    Jira
    serverASF JIRA
    serverId5aa69414-a9e9-3523-82ec-879b028fb15b
    keyOFBIZ-4160


    Anchor
    certificates
    certificates

    Certificate for RMI

    You need to have the ofbizrmi.jks and ofbiztrust.jks setup at both ends. For testing, the easiest way is

    • to create a certificate,
    • export it to the trust store ,
    • and then just copy both these files to the other instance.

    For production, remember that the truststore of the "client" would hold the public key exported from the keystore of the "server". Conversely the truststore of the "server" would hold the public key exported from the keystore of the "client". Making the keystore and truststore identical on both sides makes life a bit easier for testing, but make sure you toughen things up before you go into production!!!

    Thanks to Andrew Sykes

    Anchor
    TxStamp
    TxStamp

    About lastUpdatedStamp, lastUpdatedTxStamp (transaction), createdStamp, and createdTxStamp

    They are the timestamps that the entity engine automatically maintains for all entities, unless you use no-auto-stamp=true in the entity definition. But by default all entities will have these four fields.

    The transaction stamps are when the transaction was begun that the change is part of, and the stamps are within that transaction, although they are an absolute value. But to order the actual records that changed within the transaction. The entity engine does do things for these stamp fields when it maintains them, by the way, that ensure that within a transaction each updated or created stamp, depending on whether it's a create or updated, is unique for that transaction.

    So it'll keep track of the last one and always increment it by one, even if it's been less than a millisecond since the other record went through. As long as you don't have more than a thousand records going into the database per second in a single transaction then you shouldn't have problems with overflowing it too much.

    But it is important that those are unique, so we can order all the records by these stamps and basically reproduce the transaction to send it over to the other server. Even reproducing the transaction we can't always eliminate problems with foreign keys. Anyway that's the intention here, to reduce problems with foreign keys as much as possible and recreate the data changes on the remote server when the synchronization goes through

    Adapted from Advanced Framework Transcription PDF

    Anchor
    CurrencyExchangeRate
    CurrencyExchangeRate

    How are managed transactions in different currencies from the one of GL ?

    Accounting transactions originated by events in different currencies from the one of GL are automatically converted using the currency exchange rate of the date of the transaction.
    The "company base currency" is set in the partyAcctgPreference. You have to enter a record in the CurrencyUomDated entity.
    If this information is available then you'll notice that the AcctgTransEntry will have two different amounts in the fields amount/currencyUomId and origAmount/origCurrencyUomId

    The modification is done by the createAcctgTransEntry service.

    From a discussion between Jacopo and Hans on dev ML

    Anchor
    primaryKeysAreVAR_CHARType
    primaryKeysAreVAR_CHARType

    Why primary keys are VAR_CHAR type in OFBiz

    1. The performance overhead is minimal on modern database systems (see EnterpriseDB guys know what they are talking about, they are offering Postgres commercial support)
    2. Character strings give significant flexibility, especially when it is common to migrate data from other systems that have characters in their IDs.
    3. Being able to prefix IDs is used in a number of places in OFBiz, including prefixes for entire systems when data transfers between them are done to separate ID spaces.

    Anchor
    XSL_FO
    XSL_FO

    Is there any WYSIWYG editors for XSL:FO ?

    Anchor
    localeXSD
    localeXSD

    Using locale XSD files instead of OFBiz remote (at http://ofbiz.apache.org/dtds) for validation and content completion

    This has (at least) 2 advantages :

    • faster
    • sure to be consistent with your revision since you use the same (locale) revision

    For that look for *-catalog.xml files in OFBiz and use them in your favorite XML editor. For instance in Eclipse : Menu Windows/XML/XML Catalog

    More details here

    Anchor
    hideProductsIneCommerce
    hideProductsIneCommerce

    How to hide products in eCommerce ?

    If a View Allow category is configured only the products in that category will be visible when this catalog is active. Other products will not show up in search results, category browsing, and if someone tries to view the product by ID it will report that no product is found for this ID. There is a performance impact associated with the use of this category, so alternatives might be desirable in certain circumstances. In general for easier maintenance it is best to have this set to the same category as the Default Search category.
    But in general for Catalog Setup you shoud refer at this section of the Apache OFBiz Business Setup Guide

    Anchor
    ServerHardwareforOfbizhosting
    ServerHardwareforOfbizhosting

    Performance : Server Hardware for Ofbiz hosting

    Because customizations can dramatically change the performance
    characteristics of OFBiz it is a good idea to always do performance
    and load testing once development is complete.

    That said... a decent mid-range server (dual processor, 4GB RAM for
    example) can typically handle a peak of about 100,000 page hits per
    hour, or that's what I use as a typical rule of thumb for early
    estimates. Typically the peak hours are concentrated into certain
    times of day, and as another rule of thumb I usually use an effective
    10 hour day for estimates, so that makes roughly 1,000,000 page hits
    per day.

    In short your estimate of 100,000 page hits per day is WELL within
    what a single server can handle, even with the database and app server
    running on the same machine.

    -David Sep 02, 2009

    Anchor
    FontsInFOP
    FontsInFOP

    Using TTF fonts in FOP

    You can use TTF fonts in fo.ftl files. You need to use file "framework/webapp/config/fop.xconf". This file contain following code that responsible for font family, change font family according to the requirement, exemple

    Code Block
    <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>
    </font>
    

    I found that I could put this:

    Code Block
    <fonts>
      <auto-detect/>
    </fonts>
    

    And FOP now sees all the TTF's that the system knows.

    A tip from Brajesh Patel & James Mcgill

    Anchor
    ValidationInForms
    ValidationInForms

    Validation in forms

    1. include a js code like below:

      Code Block
      Event.observe(window, 'load', function() {if ($('formId'))  validateNewUser = new Validation('formId', {immediate: true});}
      



    2. And in the respective form use the suitable class for form fields

      Code Block
      <field ... widget-style="required"> ... </field>
      <field ... widget-style="validate-email"> ... </field>
      <field ... widget-style="validate-url"> ... </field>
      



    More at Really easy field validation
    A tip from Atul Vani

    Anchor
    DifferenceBetweenEventAndService
    DifferenceBetweenEventAndService

    What is the difference between Event and Service?

    • Events are used for validation and conversion using map processor, while services are used for business logic like CRUD operation
    • Service returns Map
    • Event returns String.
    • Services are loaded with the server, any changes in definition (not implementation if in MiniLang) needs a reload
    • We can call service inside event. But we cannot call event inside service.
    • An event is specific local piece functionality normally used in one place for one purpose and called from its location.
    • A service is a piece of functionality which can be located anywhere on the network, is most of time used in several different places and is called by its 'name'
    • In case of events you have access to HttpServletRequest and HttpServletResponse objects and you can read/write whatever you want. In case of services, you have access only to service parameters.
    • Services perform transaction rollback if any error occurs, not events. Note though that if an event is implemented by a simple-method, since by default simple-methods are executed inside a transaction unless the simple-method is flagged to not use a transaction, an error will also rollback the event.

    Anchor
    HowToChangeTheDefaultMessages
    HowToChangeTheDefaultMessages

    How to change the default messages

    The messages that come in different pages in OFBiz are configured using several configuration files. The best parts of message display framework under OFBiz are as follows:

    1. It is totally internationalized.
    2. Actual text messages are stored in configuration files only. This configuration files are written in XML using property key value approach. The actual files like FTL files, service definition files which use these text messages refers to the property key and locale (optional) only to display the message in the output page.
    3. You can hide the message by just clicking on it. No reloading is required.

    The main components of the message display framework in OFBiz are

    1. messages.ftl: under ofbiz/framework/common/webcommon/includes folder. It is responsible for displaying error and event message in a specific div on the top of the content area.
    2. CommonUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common UI label elements including error / event headers and messages.
    3. CommonErrorUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common error message elements.

    Beside these two configuration files there are at least one property key value configuration file under the config directory of the respective element for almost all elements like accounting, manufacturing, service, minilang etc. under the applications and framework directories. e.g. AccountingErrorUiLabels.xml, MiniLangErrorUiLabels.xml, ServiceErrorUiLabels.xml

    One important thing to notice here is that all UI labels in OFBiz are displayed in the same manner using the property key value XML configuration files available under the config directory. In some cases there are no separate error configuration files but the error messages are included in the UI label configuration file itself. e.g. in case of marketing component related error messages are included in the MarketingUiLabels.xml under ofbiz/applications/marketing/config folder.

    How to change a specific error message

    1. First identify the module in which the message is coming.
    2. If it is a common message then it would be in CommonUiLabels.xml or in CommonErrorUiLabels.xml
    3. If it is a module specific message then look into the configuration files under the config folder of that component.
    4. Identity the key and change the value in English language. If you presently want to change the English message only, then there is no need to do to anything else. However, if you want to update the internationalization part also then you need to do the following step for each language.
      • Now using a specific translation program like Google Language Tools, translate the English sentence into a specific language and copy paste that in the value for that specific language.
      • After the change is over you need to restart the server for the changes to take effect. You can also clear in the cache named UtilPropertiesBundleCache the resource associated to the message you've just modified. Go to Webtools -> Cache maintenance and search for UtilPropertiesBundleCache.

    The same procedure can be followed for changing the UI label elements.

    A tip from Amitava Neogi

    Anchor
    creatingViewEntityUsingEntityViewEntity
    creatingViewEntityUsingEntityViewEntity

    Note on creating a view-entity using entity or view-entity from other components

    If you need to use an entity or view-entity from other components to construct a view-entity, be cautious on how the sequence of the components are loaded. This is because the view-entity will be loaded when you start OFBiz, and if the component entity xml is loaded AFTER your component, your view-entity would not be able to pick up the relevant information from the other component.

    Therefore it is important to make sure that if you're using entities from other component, make sure they are loaded BEFORE your component.

    A tip from FooShyn

    Anchor
    WhenAndWhenNotRecompiling
    WhenAndWhenNotRecompiling

    When and when not restarting

    This is a big, and often not enough known OFBiz great feature.
    Most of the time you don't need to restart when you change things in dev mode (dev mode depends on the content of cache.properties file, see here how to set it).

    It's easier to name the main cases (I'll not get into details) where you need to restart:

    • Containers and alike configurations changes (this one seems obvious, changes related to the embedded application server - Tomcat - needs a restart)
    • Java changes (compilation)
    • DB definitions changes (entity, field, etc.)

    If the caches are on (ie not on dev mode), it's the same (you don't need to recompile) but you need to clear the caches. See at ...webtools/control/FindUtilCache You might even clear only the cache where things changed (production performance).


    Anchor
    BewareOfHTTPETag
    BewareOfHTTPETag

    Beware of HTTP ETag

    The ETag header is causing an issue with browser cache not being updated when the server has been updated. Actually a weak ETag, see http://en.wikipedia.org/wiki/HTTP_ETag

    Seems like tomcat’s DefaultServlet will only serve weak ETag’s even though tomcat7+ does have code for strong ETag but is never used and there is no documentation on how to set it

    A possible solution is to remove If-None-Match request header and ETag response header in apache http server

    RequestHeader unset If-None-Match

    Header unset ETag


    Anchor
    SQLQueriesDurations
    SQLQueriesDurations

    How to measure SQL queries durations

    If a query takes more than 150 ms its duration is shown in log. To change that look for:

    Debug.logTiming("Ran query in "

    in GenericDAO.java


    Anchor
    DifferenceListInScreen
    DifferenceListInScreen

    What is the difference between [+0] and [] in a widget screen file?

    [] If the list does not exist, create a new list and append item to it. If the list exist, append item to the end of the list

    [+0] If list does not exist, create a new list and append item to it. If the list exist, insert item at the beginning of the list


    Anchor
    WorkflowEngine
    WorkflowEngine

    What's the recommended workflow engine in OFBiz? Is it Shark?

    OFBiz gave up on Workflow Engines. Shark was implemented last but never really used in OFBiz. Instead of using a Workflow Engine, OFBiz uses an Event Driven Architecture (EDA), so ECAs (SECA, EECA, MECA) are used in OFBiz to drive the Workflow. ECA is the acronym of Event Condition Action. SECAs are for Services (triggered on services conditions), EECAs are for Entity (triggered on entities conditions), MECAs are for Mail.


    Anchor
    dash_vs_en_dashes
    dash_vs_en_dashes

    Dash vs "en dash" in Gradle commands

    When you use a command like

    gradlew "ofbiz --load-data readers=seed,seed-initial,ext,ext-demo"
    

    Beware that copying this command in Microsoft Word will automatically transform the double dash in "en dashes" (Unicode 0x2013: "–" from Unicode Map€“)
    Other cases not related to Word were also reported.So when this command does not work check that you are really using dashes!

    Anchor
    windows10
    windows10

    If you have problems to buid OFBiz on Windows 10 try this:

    from Turn windows feature on or off ->Windows subsystem for Linux->Restart and retry

    ...

    Why primary keys are VAR_CHAR type in OFBiz

    1. The performance overhead is minimal on modern database systems (see EnterpriseDB guys know what they are talking about, they are offering Postgres commercial support)
    2. Character strings give significant flexibility, especially when it is common to migrate data from other systems that have characters in their IDs.
    3. Being able to prefix IDs is used in a number of places in OFBiz, including prefixes for entire systems when data transfers between them are done to separate ID spaces.

    ...

    Is there any WYSIWYG editors for XSL:FO ?

    ...

    Using locale XSD files instead of OFBiz remote (at http://ofbiz.apache.org/dtds) for validation and content completion

    This has (at least) 2 advantages :

    • faster
    • sure to be consistent with your revision since you use the same (locale) revision

    For that look for *-catalog.xml files in OFBiz and use them in your favorite XML editor. For instance in Eclipse/Oxygen : Menu Windows/Options Preferences/Oxygen/XML/XML Catalog

    ...

    How to hide products in eCommerce ?

    If a View Allow category is configured only the products in that category will be visible when this catalog is active. Other products will not show up in search results, category browsing, and if someone tries to view the product by ID it will report that no product is found for this ID. There is a performance impact associated with the use of this category, so alternatives might be desirable in certain circumstances. In general for easier maintenance it is best to have this set to the same category as the Default Search category.
    But in general for Catalog Setup you shoud refer at this section of the Apache OFBiz Business Setup Guide

    ...

    Performance : Server Hardware for Ofbiz hosting

    Because customizations can dramatically change the performance
    characteristics of OFBiz it is a good idea to always do performance
    and load testing once development is complete.

    That said... a decent mid-range server (dual processor, 4GB RAM for
    example) can typically handle a peak of about 100,000 page hits per
    hour, or that's what I use as a typical rule of thumb for early
    estimates. Typically the peak hours are concentrated into certain
    times of day, and as another rule of thumb I usually use an effective
    10 hour day for estimates, so that makes roughly 1,000,000 page hits
    per day.

    In short your estimate of 100,000 page hits per day is WELL within
    what a single server can handle, even with the database and app server
    running on the same machine.

    -David Sep 02, 2009

    ...

    Using TTF fonts in FOP

    You can use TTF fonts in fo.ftl files. You need to use file "framework/webapp/config/fop.xconf". This file contain following code that responsible for font family, change font family according to the requirement, exemple

    Code Block
    
    <font metrics-url="arial.xml" kerning="yes" embed-url="arial.ttf">
      <font-triplet name="Arial" style="normal" weight="normal"/>
      <font-triplet name="ArialMT" style="normal" weight="normal"/>
    </font>
    

    I found that I could put this:

    Code Block
    
    <fonts>
      <auto-detect/>
    </fonts>
    

    And FOP now sees all the TTF's that the system knows.

    A tip from Brajesh Patel & James Mcgill

    ...

    Validation in forms

    1. include a js code like below:
      Code Block
      
      Event.observe(window, 'load', function() {if ($('formId'))  validateNewUser = new Validation('formId', {immediate: true});}
      
    2. And in the respective form use the suitable class for form fields
      Code Block
      
      <field ... widget-style="required"> ... </field>
      <field ... widget-style="validate-email"> ... </field>
      <field ... widget-style="validate-url"> ... </field>
      

    More at Really easy field validation
    A tip from Atul Vani

    ...

    What is the difference between Event and Service?

    • Events are used for validation and conversion using map processor, while services are used for business logic like CRUD operation
    • Service returns Map
    • Event returns String.
    • Services are loaded with the server, any changes in definition (not implementation if in MiniLang) needs a reload
    • We can call service inside event. But we cannot call event inside service.
    • An event is specific local piece functionality normally used in one place for one purpose and called from its location.
    • A service is a piece of functionality which can be located anywhere on the network, is most of time used in several different places and is called by its 'name'
    • In case of events you have access to HttpServletRequest and HttpServletResponse objects and you can read/write whatever you want. In case of services, you have access only to service parameters.

    ...

    How to change the default messages

    The messages that come in different pages in OFBiz are configured using several configuration files. The best parts of message display framework under OFBiz are as follows:

    1. It is totally internationalized.
    2. Actual text messages are stored in configuration files only. This configuration files are written in XML using property key value approach. The actual files like FTL files, service definition files which use these text messages refers to the property key and locale (optional) only to display the message in the output page.
    3. You can hide the message by just clicking on it. No reloading is required.

    The main components of the message display framework in OFBiz are

    1. messages.ftl: under ofbiz/framework/common/webcommon/includes folder. It is responsible for displaying error and event message in a specific div on the top of the content area.
    2. CommonUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common UI label elements including error / event headers and messages.
    3. CommonErrorUiLabels.xml: under ofbiz/framework/common/config folder. This is a property key value configuration file for storing common error message elements.

    Beside these two configuration files there are at least one property key value configuration file under the config directory of the respective element for almost all elements like accounting, manufacturing, service, minilang etc. under the applications and framework directories. e.g. AccountingErrorUiLabels.xml, MiniLangErrorUiLabels.xml, ServiceErrorUiLabels.xml

    One important thing to notice here is that all UI labels in OFBiz are displayed in the same manner using the property key value XML configuration files available under the config directory. In some cases there are no separate error configuration files but the error messages are included in the UI label configuration file itself. e.g. in case of marketing component related error messages are included in the MarketingUiLabels.xml under ofbiz/applications/marketing/config folder.

    How to change a specific error message

    1. First identify the module in which the message is coming.
    2. If it is a common message then it would be in CommonUiLabels.xml or in CommonErrorUiLabels.xml
    3. If it is a module specific message then look into the configuration files under the config folder of that component.
    4. Identity the key and change the value in English language. If you presently want to change the English message only, then there is no need to do to anything else. However, if you want to update the internationalization part also then you need to do the following step for each language.
      • Now using a specific translation program like Google Language Tools, translate the English sentence into a specific language and copy paste that in the value for that specific language.
      • After the change is over you need to restart the server for the changes to take effect. You can also clear in the cache named UtilPropertiesBundleCache the resource associated to the message you've just modified. Go to Webtools -> Cache maintenance and search for UtilPropertiesBundleCache.

    The same procedure can be followed for changing the UI label elements.

    ...