HOWTOs and FAQs

From ADempiere
Revision as of 06:22, 5 July 2010 by Mar cal westf (Talk)

Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

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

HOWTOs

Alerts

  • 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.

  CD %ADEMPIERE_HOME%\utils

4. Execute in the CLI,

  RUN_DBExport
  This will provide some feedback in the CLI.

5. Navigate to the Data folder,

  CD %ADEMPIERE_HOME%\data

6. Execute

  DIR

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.

  CD %ADEMPIERE_HOME%\utils

4. Execute in the CLI,

  RUN_DBRestore


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 - RUN_setup.sh 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
serverStart.sh 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 http://127.0.0.1:8080. But wont work if you try to access http://192.168.0.103:8080.

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


Troubleshooting

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: 
  	java.net.BindException: Address already in use: JVM_Bind
  	at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:249)

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.

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.

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

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.

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

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.

Customizations

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
     AND EXISTS (
            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

Window

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.

You cannot access these fields within java in case you want to do something else with them. Here comes GenerateModel in action, generating in the model files (the ones with prefix X_ and I_) the needed constants and methods in order to access them via java.

If you don't intend to program with Adempiere, forget GenerateModel. Otherwise, you better learn working with it.