View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

Update Tips

Contents

Introduction

This page is designed to include some tips related to rebuilding the system when installing or upgrading modules, or upgrading Openbravo Core.

Before rebuilding

Before rebuilding the system, it's very important to make sure you've exported all the modules you had in development in the system. To be sure of this, mark all your developed modules as "In development", and then do:

ant export.database

This should export all the modules to xml files.

If you don't do this, the rebuild task could revert some non-exported developments.

While rebuilding

While rebuilding the system, it's very important that you do not close the Rebuild Window, or stop Tomcat or the database service.

Be patient, some rebuild tasks can take a while (specially if you are upgrading Openbravo Core).

After having rebuilt the system

In case the build was successful

If the rebuild was completely successful, you will get a green "Build succesful" message. You then need to restart Tomcat to be able to use the new installed modules, or the new version of Core. You can do this through the Rebuild Window by choosing the "Restart application container" option, and clicking on "Continue". Wait until you see the the login window again, and you are good to go!

In case the build had warnings

If the build had warnings, this means two things:

Here are some tips of what you could do in case there were warnings:

In case the build had critical errors

This is a very special case that has to be handled with extreme care. If there was a critical error in the build, this means that it is very possible that the data inside Openbravo is at risk.

The best course of action when a critical error happens is to restore a backup of your database. If this is not possible, then you need to find out the cause of the error, and take the necessary steps to ensure that your data is safe. These steps are very tricky, and require significant knowledge on how the Openbravo database works, so it is a good idea to contact with an expert before attempting to recover the data yourself, if you are not really sure of what you are doing.

The main cause of this error is that the rebuild failed while trying to recreate a database table. You will be able to find out which table was affected by looking at the error.

Let's assume that the C_Invoice table was affected. This means that the C_Invoice table either has been deleted and not created successfully, or created but with a problem which prevents your data from being inserted back into it.

In both cases, you need to make sure that the table exists and its design is correct and compatible with your data.

Once you have verified that the table exists, you need to copy your data back from the auxiliary table that the process has automatically created. In our example, you can do it by executing the following SQL command in the database:

INSERT INTO C_Invoice SELECT * FROM C_Invoice_

If this command succeeds, then your data is now safe. However, you still need to find out why the problem happened. The main cause of this problem is likely to be a module or industry template you just installed. If that is the case, then you can uninstall it, and rebuild the system:

ant smartbuild -Dlocal=no -Dforce=true

Important: Do not execute this command before making sure that your data has been moved correctly to the main table (in this example, C_Invoice). If the data is not moved before executing this command, it will be lost forever.

In case the build had other errors

If the build has errors, the build process is interrupted. As the build process is stopped, the application can be in a potentially unstable state. You will only be able to login using a user which has System Administrator role permission. Your objective in this case should be to fix the errors that caused the problems, and do a new rebuild which is succesful. Here are some tips on what you could try:

In case module download hangs up

If the modules are being installed/updated online, it is possible the download process hangs up in case the Internet connection does not work properly or in case of problems in the remote server.

This can be noticed if after accepting the module(s) license the following window does not appear in a long time. Note that the download process can take several minutes to be completed depending on the number of modules downloaded and on the size of them. If you look in your log file you will see a line like INFO org.openbravo.erpCommon.modules.ImportModule - Installing /ws/pi-2/openbravo/modules/org.openbravo.examples.search.bankAccount/src-db/database/sourcedata/AD_REFERENCE.xml for each downloaded file and finishes with INFO org.openbravo.erpCommon.modules.ImportModule - Inserting in DB info for module: Bank Account Search, if this line does not appear is because the download did not finish.

The solution for this issue depends on whether the download was for an update or for a new module installation.

Update

In this case you will find in the backup_install directory a zip with the sources for the module (or core) as it was before the process. You will have to unzip it in the modules directory if it is a module or in the root openbravo directory for core.

After this you will be able to try to update the module again in the same way or download the obx file and update it locally from file system.

Installation

Go to modules directory and delete the folder for the module you were trying to update which is not complete.

After this you will be able to try to install the module again in the same way or download the obx file and install it locally from file system.

In case the build hangs up

Blocked database objects

If the process hangs up in the database update step, it is possible there was a blocked table that is causing a deadlock. These blocks can be produced by other processes/users accessing to database.

To solve this issue, you can follow these steps which are explained more in detail below:

Check for blocked objects

This check consists in executing a query in database. To do it you will have to connect to your openbravo database using a database client (for example psql for PostgreSQL or sqlplus for Oracle) with a user with dbadmin privileges.

 
 SELECT c.relname, a.current_query
   FROM pg_locks l, pg_class c, pg_stat_activity a
  WHERE l.relation = c.oid
    AND c.relname NOT LIKE 'pg%'
    AND a.procpid = l.pid;
 
SELECT S.PROCESS,
S.USERNAME,
O.OBJECT_NAME,
O.OBJECT_TYPE,
s.PROGRAM, 
O.OWNER OWNER
FROM v$lock l,dba_objects o,v$session s
WHERE l.ID1 = o.OBJECT_ID
AND s.SID =l.SID
AND l.TYPE IN ('TM','TX');

These queries will return a list of the blocked tables and the process that caused the block.

Unlock blocked objects

If the previous step is positive (there are blocked objects), it will be necessary to unlock them before continuing.

The steps to perform are:

Rerun the build

Once there are no blocked objects you will be able to run the build process again by executing in command line:

ant update.database compile.complete.deploy -Dforce=yes

Retrieved from "http://wiki.openbravo.com/wiki/Update_Tips"

This page has been accessed 10,268 times. This page was last modified on 29 May 2012, at 13:56. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.