From ADempiere
Revision as of 06:35, 13 January 2011 by Ralexsander (Talk) (What is the need for GenerateModel?)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

PENDING TASK: Merge this page with -> FAQ

HowTos and FAQs provide simple explanations for common tasks and problems faced by users. The links below direct you to specific HowTo and FAQ pages.

Note.gif Note:

This is a work in progress. Please help. If you wish to contribute a HowTo or FAQ, please follow the HowTo and FAQ Style Guide



  • In ADempiere, Alerts can be set to send information to interested users at specific times or when specific conditions in the database are met. Think of them as automated reports or warnings. Daily activity reports, forecasts, lease expiry warnings, data storage limit warnings - basically anything that you can define with a SQL query, can be turned into an Alert. What information is sent and the triggers that cause it to be sent can all be configured in the application without any sourcecode changes. See the How To article Creating an Alert for more information.

RUN_DBExport (Backing Up Adempiere Database)

Adempiere has provided a script (bat / sh) file to perform the exporting of the Adempiere database.

The steps are based on version 3.4.0s. It should be the same on other versions of Adempiere.

Steps - Windows (version 3.4.0s)

1. Ensure you are logged out of Adempiere and the Service has been stopped.

  This is to make sure that no activity is occurring in the database and you get a complete backup.

2. Open a CLI (command line) 3. Navigate to the folder with the script.


4. Execute in the CLI,

  This will provide some feedback in the CLI.

5. Navigate to the Data folder,


6. Execute


7. Two files should be created,

  - ExpDat.dmp
  - ExpDat<date&time>.jar

The JAR file is a JAVA compressed file of the "dmp" file. You can delete the ExpDat.dmp file.

Make sure, you backup the "ExpDat<date&time>.jar" in your regular backup cycle.

The "RUN_DBExport" will determine (from saved variables) what type of database you are running and then execute the appropriate "DBEXPORT" script file.

Note, you do not need to use the supplied "RUN_DBExport" script and could run your own preferred database export program.

Database Restore

As mentioned you could delete the ExpDat.dmp file as it is duplicated in the compressed jar file, but also provided in the ADEMPIERE_HOME/utils directory is the RUN_DBRestore[.sh/.bat] script which will restore this ADEMPIERE_HOME/data/ExpDat.dmp file created by the RUN_DBExport script above.

The process to restore mirrors that of the Export.

1. Ensure you are logged out of Adempiere, the Service has been stopped and the DB has no users logged in. 2. Open a CLI (command line) 3. Navigate to the folder with the script.


4. Execute in the CLI,


The entire Adempiere database will be dropped and then reloaded anew from the supplied ExpDat.dmp

RUN_ImportAdempiere related

Create new adempiere database with postgresql

These steps used Adempiere-316 with postgresql-8.1.4 and pljava-1.3 on Centos-4.4. A source rpm for postgresql is available (insert link here). I created a spec file for pljava (this wiki doesn't seem to allow source uploads).

1 - createuser -U postgres -s adempiere -P

NOTE, adempiere user MUST have superuser privileges. It might be
possible to create the database as another superuser, e.g. postgres.

2 - createdb adempiere -E UNICODE -O adempiere -U adempiere

2a - if pl/pgsql is not installed in template1,
       createlang plpgsql -U postgres adempiere
2b - if pl/java is not installed in template1,
       java org.postgresql.pljava.deploy.Deployer -install -database adempiere
2b might not actually be necessary. The next step will complain about sqlj being already installed.

3 - psql -d adempiere -U adempiere < Adempiere_pg.dmp > load.log

4 - review load.log if there are errors

5 - psql -d adempiere -U adempiere

5a - select sqlj.install_jar('file:/C:/Adempiere/lib/sqlj.jar','sqlj',true);
5b - SELECT sqlj.set_classpath('adempiere', 'sqlj');
5c - SET search_path TO adempiere,public;
5d - select bpartnerRemitLocation (118);
5d is for testing it must return 120, if it returns ok installation of db is completed before 1 and 2 you must drop user and/or database if created for 5a, you must change the path of sql.jar

6 - as adempiere (may need to set XAUTHORITY).

6a - mkdir $ADEMPIERE_HOME/jboss/server/adempiere/log
ADEMPIERE_HOME *MUST* be $HOME/Adempiere. That is hard-wired in somewhere. Trying to set it to $HOME/Adempiere-316, for
instance gets "tail: cannot open `/home/adempiere/Adempiere/jboss/server/adempiere/log/adempiere_20070403172701.log' for reading: No such file or directory"
6b - edit $ADEMPIERE_HOME/jboss/server/adempiere/conf/jboss-service.xml and add one to the port number for jboss:service=WebService. Setup assigns the same port to both the web server and

web services - at least it did for me.

RUN_Setup related

Can't access http://server_name:8080 from clients

I've installed Adempiere and I'm not able to connect to it using a windows xp client. From the server machine, going to http://server_name:8080 works and I see the webstart homepage. So does But wont work if you try to access

This problem can arise when the client can't resolve the name server_name. 
Install RUN_Setup giving the IP address


Implementations / Running Server

java.rmi.server.ExportException: Port already in use:

When you start running Adempiere you may find that you are having errors appearing in the log with a message indicating that the "Port already in use".

This could be that you have multiple instances of the JBOSS server running or you have another application that is using the same port number.

Firstly, you need to identify what is using the port in question.

  netstat -abv > netstat.tmp

Search the file for the port number, eg 1099, 1098

If you find another instance of the server running, then terminate the process. Once, terminated, see if you run the Adempiere server.

If you find that it is another application running using the JBOSS port, then you need to decide if you can change the port it is using or change the port used by JBOSS for Adempiere.

Change JBOSS Port

You may have a conflict with one or both ports used in Adempiere by JBOSS. Have a close look at the error message and establish which port number is the problem.

For example,

  2008-06-23 16:47:52,375 ERROR [org.jboss.naming.NamingService] Starting failed jboss:service=Naming
  java.rmi.server.ExportException: Port already in use: 1098; nested exception is: Address already in use: JVM_Bind
  	at sun.rmi.transport.tcp.TCPTransport.listen(

The above example is taken from "%ADEMPIERE_HOME%\jboss\server\adempiere\log\server.log".

You can see that the port having the conflict is 1098.


To change this port edit the following

1. Make a backup of "%ADEMPIERE_HOME%\jboss\server\adempiere\conf\jboss-service.xml" to "%ADEMPIERE_HOME%\jboss\server\adempiere\conf\jboss-service.xml_backup" (for example)
2. Edit file "%ADEMPIERE_HOME%\jboss\server\adempiere\conf\jboss-service.xml" in your favourite notepad editor
3. Search for "name="RmiPort"" (keep the " around RmiPort) or "1098"
4. Change the port number to something else, I used 2098. So, in my example the lines were:

Old line: <attribute name="RmiPort">1098</attribute>
New line: <attribute name="RmiPort">2098</attribute>

5. Save the file
6. Start the server and establish if you still have the issue.

      If you run the RUN_setup, then the jboss-service.xml is recreated. Therefore, you will make the changes again for any
      manual editing.

To change this port you can run the following "%ADEMPIERE_HOME%\RUN_setup" & change the port in field "JNP Port".

After making the change, you can click on "Test" to see that all the boxes get a tick. If correct, then click on "Save". After the set up has completed the save, you can start the server again.

      If you run the RUN_setup, then the jboss-service.xml is recreated. Therefore, you will make the changes again for any
      manual editing.

The background to my problem was with port 1098. I found that I was getting the message "Port already in use:" due to vmWare Server v2 (beta) was running JBOSS Tomcat with the same default port. Once I changed port 1098 to be 2098, the problem was resolved.

So, if you hadn't had the problem and now you suddenly find you do have the problem, think about what you may have installed recently or maybe you have changed the start up order of services.


No Identifier records found

Error loading Lookup for a field, this error is shown in the console:

===========> MLookupFactory.getLookup_TableDir: No Identifier records found: CUST_Table

  • There are no identifier columns defined in CUST_Table.
  • You must mark identifier columns with isIdentifier = 1, 2 ...

No query columns found

  • Error looking columns in fields of type Search, this error is shown in the console:

===========> InfoGeneral.initInfoTable: No query columns found

  • Adempiere tries to look String column that appears in any window, the following query is executed:
SELECT   c.columnname, t.ad_table_id, t.tablename
    FROM ad_table t INNER JOIN ad_column c ON (t.ad_table_id = c.ad_table_id)
   WHERE c.ad_reference_id = 10
     AND t.tablename = ?
--       // Displayed in Window
            SELECT *
              FROM ad_field f
             WHERE f.ad_column_id = c.ad_column_id
               AND f.isdisplayed = 'Y'
               AND f.isencrypted = 'N'
               AND f.obscuretype IS NULL)
--       //
ORDER BY c.isidentifier DESC, c.seqno

  • If the field is not displayed in any window, it's not taken as search column.

No Info for AD_Table_ID

  • Adempiere can't found information for a table, this error is shown in the console:

===========> InfoGeneral.initInfoTable: No Info for AD_Table_ID=1000001 - SELECT ... [11]

  • Adempiere tries to look for columns that appears in the window associated to the table:
SELECT   t.ad_table_id, c.columnname, c.ad_reference_id, c.iskey,
         f.isdisplayed, c.ad_reference_value_id
    FROM ad_column c INNER JOIN ad_table t ON (c.ad_table_id = t.ad_table_id)
         INNER JOIN ad_tab tab ON (t.ad_window_id = tab.ad_window_id)
         INNER JOIN ad_field f
         ON (tab.ad_tab_id = f.ad_tab_id AND f.ad_column_id = c.ad_column_id)
   WHERE t.ad_table_id = ?
     AND (c.iskey = 'Y' OR (f.isencrypted = 'N' AND f.obscuretype IS NULL))
ORDER BY t.created DESC, c.iskey DESC, f.seqno
  • The following statement associates a window for tables without the association:
UPDATE ad_table
   SET ad_window_id = (SELECT MIN (ad_window_id)
                         FROM ad_tab
                        WHERE ad_tab.ad_table_id = ad_table.ad_table_id)
 WHERE tablename LIKE 'DICB\_%' ESCAPE '\' AND ad_window_id IS NULL


The history button is not getting active. What should be checked?

The history button is active only if:

  • Is first tab selected
  • The window type is transaction
  • The table must have a Processed column

Development FAQ

Add an information message

ADialog.warn(WindowNo, new ConfirmPanel(),"Information message")

Where to put extensions

  • You should place your extensions in extend/src.
  • You should define at least this one as Java Sources directory. Others as well if you change standard classes.
  • For PO classes:
    • Then respect coding conventions that can be found in M_Table.getClass(String)
    • Basically : compiere.model.MThisIsMyTable for a table THIS_IS_MY_TABLE
  • For Validation classes:
    • Look at ModelValidationEngine()
  • Define in your Client the field ModelValidationClasses with you validation classes.
    • They must implement ModelValidator.
    • Look at example MyValidator.
  • You can also define field level business logic using the callout mechanism.
  • Your extension class must implement the Callout interface and then reference in the field setup screen.
  • Make sure Eclipse is setup in Auto Compilation mode.
  • Anyway, all this is based on Reflection so the only thing to make it work is that Eclipse find the classes at the right place.

What is the need for GenerateModel?

Creating fields with Application Dictionary enables you to create, update delete and modify them in windows, tables and access them in reports.

GenerateModel generate getters, setters and needed constants on model classes (the ones with prefix X_ and I_) to ease access of new fields within java in case you want to do something else with them.

It's not strictly needed, you can access your custom columns (or any) using generic getters and setters from the class, like get_Value(columnName) or set_ValueOfColumn(columnName, value)

It's discouraged to generate X_ classes for extensions or customizations, because of the potential conflict between different model classes. For example if you add some columns to C_Order table and change the X_C_Order class, and at the same time an extension modify the same class, there will be conflict between both classes.

The recommended approach is to create a custom interface that is extending the original table model interface and then use the POWrapper class in your code to access the table fields.

For example, if you added more columns to C_Invoice table, then you need to create a new interface, something like this:

package com.mycompany.myproject.model;
public interface I_C_Invoice_Customized extends org.compiere.model.I_C_Invoice
	public int getCustomValue1();
	public void setCustomValue1(int customValue1);
	public String getCustomString1();
	public void setCustomString1(String customString1);

Please note that you can use any naming convention for your interface and also you can put it in any package you like.

After this, in your code, you can access the invoice persistent object by using your custom interface like this:

MInvoice invoice = ......;
I_C_Invoice_Customized invoiceCustomized = POWrapper.create(invoice, I_C_Invoice_Customized.class);
invoiceCustomized.setCustomString1("my test string");
invoiceCustomized.setDescription("my description"); // please note that u can access the original fields too
// To save the modified PO, you can use:
invoice.saveEx(); // direct same the PO
// or if the PO is not accessible in your method, you can do:

How can I change appearance of webui login page?

In trunk/zkwebui/theme/default there are a couple of files: login-left.zul, vendor-logo.zul, version-info.zul etc.

File version-info.zul contains the server info data. You can change these files so the login page appears as you please.

In file vendor-logo.zul there is the possibility of customization to own logo, links etc.

Configuring the files in trunk/zkwebui/theme/default enables you to change the appearance of the webui login page to your needs.

A build is needed.

How can I debug combo boxes in Eclipse?

In linux, Eclipse and the whole computer freezes when debugging the contents of a combo box. Neither mouse nor keyboard work.

The only help is logging in from a remote machine via ssh and killing the process. If there isn't such possibility, you have to shut down manually the machine.

There is an easy way in the eclipse configuration in order to avoid this nuisance: select in menu/Run/Debug Configurations the tab Arguments. In the text field VM Arguments, add the parameter -Dsun.awt.disablegrab=true . Thanks to Dirk Niemeyer .

Here the text: "The only reasonable solution to this problem is introducing the system property sun.awt.disablegrab which, if passed as the boolean value of true, effectively disables acquiring grabs on X11 platforms. If the user wishes to debug an application and sets a breakpoint in an event handler that gets fired while a popup window is opened (like a combobox popup), the user must specify this system property before debugging the application as follows: java -Dsun.awt.disablegrab=true ...<other_options>... All known IDEs allow specifying the user-supplied command line options to the java command, making this solution easily adoptable. For instance, in Netbeans open the properties of the project, go to the Run section and type the text "-Dsun.awt.disablegrab=true" (w/o the quotes) into the VM Options editbox. Of course, the project must be configured to run with a JRE having the suggested fix in place. "