Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 129 Next »

This page is intended to be the root of Cookbook, FAQ, Tips, Tricks, HowTo, etc. (will perhaps be separated later).
You may find supplementary usefull informations at Old OFBiz wiki and Opentaps's OFBiz cookbooks part

Tables of content  

Accounting

Apache HTTPD (Apache Web server)

Ajax - Javascript - Json

Applications server

Birt

CSS

DataBase

Development tips

Eclipse

Google

Lamba Probe

Miscellaneous

Netbeans

Payment

POS

Production Tips

Quick Start Guides

RMI

Searches

Selenium

Soap

  • How to use SOAP
    • A tutorial from Vincenzo Di Lorenzo, see Attachements
    • A tutorial from Opentaps documentation (version 0.9v5), see Attachements
      You could also be interested by these links
      Complex types
      Arrays
      Another approach

SSL

Translation

Windows

 

FAQ - TIPS - Cookbook - How to 

How to use mod_proxy_ajp

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

In httpd.conf 

Uncomment (or compile with at least these modules using --enable)

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

Set ServerAdmin, ServerName

Add something like

ProxyRequests Off

<Proxy \*>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddDefaultCharset off
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Order deny,allow
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>
&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; General setup for the virtual host
&nbsp;&nbsp;&nbsp; DocumentRoot "/usr/local/apache2/htdocs"
&nbsp;&nbsp;&nbsp; ErrorLog logs/error_log
&nbsp;&nbsp;&nbsp; TransferLog logs/access_log

&nbsp;&nbsp;&nbsp; ServerName lamouline.myvnc.com
&nbsp;&nbsp;&nbsp; ServerAdmin webmaster@les7arts.com

&nbsp;&nbsp;&nbsp; ProxyRequests Off
&nbsp;&nbsp;&nbsp; ProxyPreserveHost On
&nbsp;&nbsp;&nbsp; proxyPass / ajp://localhost:8009/
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; RewriteEngine On
&nbsp;&nbsp;&nbsp; RewriteRule \^/(images/.+);jsessionid=\w+$ /$1&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;
</VirtualHost>

include conf/httpd-ssl.conf
In httpd-ssl.conf

replace

<VirtualHost \_default_:443>

\#&nbsp;&nbsp; General setup for the virtual host
DocumentRoot "/usr/local/apache2/htdocs"
ServerName www.example.com:443
ServerAdmin you@example.com
ErrorLog "/usr/local/apache2/logs/error_log"
TransferLog "/usr/local/apache2/logs/access_log"

by

<VirtualHost \*:443>
&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; General setup for the virtual host
&nbsp;&nbsp;&nbsp; DocumentRoot "/usr/local/apache2/htdocs"
&nbsp;&nbsp;&nbsp; ErrorLog "/usr/local/apache2/logs/error_log"
&nbsp;&nbsp;&nbsp; TransferLog "/usr/local/apache2/logs/access_log"

&nbsp;&nbsp;&nbsp; ServerName lamouline.myvnc.com
&nbsp;&nbsp;&nbsp; ServerAdmin webmaster@les7arts.com

&nbsp;&nbsp;&nbsp; ProxyRequests Off
&nbsp;&nbsp;&nbsp; ProxyPreserveHost On
&nbsp;&nbsp;&nbsp; proxyPass / ajp://localhost:8009/
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; RewriteEngine On
&nbsp;&nbsp;&nbsp; RewriteRule \^/(images/.+);jsessionid=\w+$ /$1&nbsp;&nbsp;&nbsp;&nbsp;

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

Additional notes for configuring mod_ajp_proxy

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 application. For example:

Mounting Ofbiz application as show below will forward every request to Ofbiz including request for static resources such as images.

    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

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

Configure the Images folder in the Apache as shown below:

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

/var/www/xxxx/images directory is where Apache will look for your images.

Thanks to Raj Saini for this tip 

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.

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 : http://docs.ofbiz.org/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse#RunningandDebuggingOFBizinEclipse-Connectingthedatabase

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

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:

After that Fin Account available balance will be 1000. You can check this here:
https://demo.hotwaxmedia.com/accounting/control/EditFinAccount?finAccountId=10000 - field "Available Balance".

Then you are ready to create order and to specify the GC as a payment method.

A tip from Rashko Rejmer

Ajax : Disable Browser Cache for Module

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

A tip from Krzysztof Podejma

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)

Using Toirtoise from Files Explorer (Create Patch, Apply Patch context menu options)

Making a diff with subversion on command line : svn di fileName > filename.patch

I let you find the tools (Eclipse/Subclipse, Tortoise, Subversion client, patch.exe, todos.exe with google ;o)

Applying patches

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 Tortoise's "Apply Patch" option in a 1st step. Tortoise is the best SVN and CVS UI existing, either on Linux or Windows. Besides Tortoise comes from Tigris too.
Then if I get problems with Tortoise (or Eclipse's "Apply Patch" option wich is near Tortoise for patching but less supple for this option and far more ingeneral) I 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 :

todos %1
patch -p0 < %1

where todos is and exe to download (search with Google). Of course you will have to deal with path. But at this stage I guess it's easy...

 I just learned from https://sourceforge.net/project/shownotes.php?release_id=508633 that the "--binary" option may be used in that case, did no try yet...

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:
    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

Advice from  enki_ at users.sourceforge.net. There is an alternative to this solution : How to Run OFBiz as Windows Service with Java Service Wrapper

Some Selenium tips

Due to some license issues with external libraries used in Selenium we cannot include this in the Apache trunk. However, a new component has been created which is free to download and use, but lives in an ofbizext repository.
https://svn.hotwaxmedia.com/svn/ofbizext/selenium Drop this in hot-deploy. If you want to know more, please look at https://issues.apache.org/jira/browse/OFBIZ-680

1) For running "successive" test cases I used browser "Refresh" button but I think there might be some better option to handle this. Is there any option exists in Selenium IDE ?
If you want to chain execution of different tests, there is the notion of test suite. A list of tests to run one after the other (see http://labs.libre-entreprise.org/plugins/scmcvs/cvsweb.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/ManufacturingTestSuite.html?rev=1.9;content-type=text%2Fplain;cvsroot=neogia)

Otherwise if you just want to replay the same test in a loop, I'm not aware of a such feature in selenium. Bur if the loop is finite, you can achieve a similar result by using a test suite that refers x times the same test.2) Suppose I have a condition to create the new user each time. As I can put the value of user login say "user1" for the first time but when this test case runs second time it generates error (It hangs up in between). So Is there any option to put a "counter" or Javascript code
in the Test cases so I could create the "user2" when this test case runs second time ??
The general problem behind you issue is how to run a test multiple times wihtout risking duplicated primary keys or having to remove all data created by the test.

One solution is to always create business objects with different identifiers. Selenium provides a nice feature to do that: you can define variables during the test execution and use them anywhere in the test script after their creation.

Here an example based on one of my test (http://labs.libre-entreprise.org/plugins/scmcvs/cvsweb.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestCreateNomenclature.html?rev=1.6;content-type=text%2Fplain;cvsroot=neogia)

<!-- 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>
<!-- 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:

<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:

<tr>
<td>clickAndWait</td>
<td>submit</td>
<td></td>
</tr>

The code above is getting a "Permission Denied" message. I already check the URLs and I'm not launching a different domain (before I click I have http://domain/Login/ and after the submission I have http://domain/App/).

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/plugins/scmcvs/cvsweb.php/ofbizNeogia/neogia/manufacturing/webapp/manufacturing/tests/TestProcessRouting.html?rev=1.2;content-type=text%2Fplain;cvsroot=neogia)

<!-- 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 -->

Advices from Peter Goron

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.

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), "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.

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)

    <resources>
      <resource>
        <directory>../../../framework/base/config</directory>
      </resource>
      <resource>
        <directory>../../../framework/base/dtd</directory>
      </resource>
      <resource>
        <directory>../../../framework/datafile/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>

A Ryan's (from Sourcelab) tip

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: https://demo.hotwaxmedia.com/marketing/control/EditContactListCommEvent?contactListId=9000&DONE_PAGE=/marketing/control/ListContactList based on the trunk demo server.

Set your from details and party roles (maybe N/A), fill your subject and content and click save.

When you're happy with it, change the status to "In-Progress" and click save again. The comm events should then start to trigger and the email flow, although you'll want to test it on a small list to start with. If the list is clean and processes through OK the status should automatically change to "Complete" when it is done but if there are badly formatted email addresses that can stick the status and you will need to manually mark as complete and you might review the logs to find the error.

At the time of this tip was wrote, the start and finish dates do not work as expected, leave them blank for your first testing.

A Ray Barlow's tip

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:

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

And run the

"run-install-extseed"

ant target instead of

"run-install"

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

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)

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

If you are not using the Accounting module much and specifically the GL section, than go to accounting --> ofbiz-component.xml and comment the entry for secas_ledger.xml in that file, restart the server and try again. This should solve your problem.

A Mridul Pathak's tip

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

From a thread by Chris Howe and David Jones
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.

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

from this I should edit the following
build.xml:
find "ecommerce"
replace with "myapp"

ofbiz-component.xml:
find "ecommerce"
replace with "myapp"

web.xml:
change display name and description from "ecommerce"
to "myapp"

Then change specialized/component-load.xml to load
"myapp"

This should give you an exact duplication of functionality of the copied ecommerce application without the hundreds of thousands of lines of code. Then by simply copying/creating the files that need to be changed and changing the requests and views in controller.xml you will have your new application, but still benefit from svn updates. What is the potential downside of this?

David Jones: Yes, this is the best practice... Being able to do this is part of the design and intention of the screen widget. BTW, the hot-deploy directory may be easier to use than the specialized directory, but of course you can mount a component from anywhere.

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

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.

Another approach is to make adifferences web app. This is where you copy the five essential files from a similar application that is being maintained by the project, make minor modifications to them.

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>
  • application\...\webapp\...\index.jsp
    • change nothing
  • applicaton\build.xml
    • <project>
      • change the name
    • <target name="init">
      • change value of property "desc"
      • change value of property "name"
    • <target name="classpath">
      • ensure all fileset dir are correctly relative to the location of your app
  • application\ofbiz-component.xml
    • <ofbiz-component>
      • change the name
    • <webapp>
      • change the name
      • change the title
      • change the location
      • change the mount point

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.


From there you need to understand how a page is rendered. It is more detailed than this, but this explanation will suffice for the majority of simple customizations.

  1. Client makes a request
  2. request (among other things) calls a view (controller.xml)
  3. view calls a screen (controller.xml)
  4. screen (*Screens.xml) calls some actions and widgets (*.bsh, *Forms.xml, *.ftl, etc)
  5. the page is rendered to the client.

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 <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 of your custom application will be easier and less error prone.

  1. REUSE REUSE REUSE. (If you don't change it, you don't have to maintain it, so don't change things just to change them)
  2. Only change copies of the OFBIZ files that are in your custom application

A David Jones's tip

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)

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:

  1. In framework/base/config/limited-containers.xml replace (or better comment out during tests)
    <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-client-auth" value="true"/>
    
    by
    <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)

  1. 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 envrionment (http://forum.java.sun.com/thread.jsp?forum=58&thread=288759&tstart=0&trange=15):

The canonical server-side solution appears to be to tell the server its IP on startup:

-Djava.rmi.server.hostname=111.222.333.444

or, more flexibly, something like:

-Djava.rmi.server.hostname=`ifconfig eth0.1:1|grep "inet addr:" | sed "s/inet addr://" | awk '{print $1}'`

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

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/applications 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.

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
    <eca service="createAcctgTransAndEntries" event="commit">
        <condition field-name="acctgTransId" operator="is-not-empty"/>
        <action service="postAcctgTrans" mode="sync"/>
    </eca>
  2. Configure an Error Journal to post there the accounting transactions that are incomplete (you will find a lot of posts about this if you search in the archives)
  • No labels