ERP 2.50:Update Tips
This page is designed to include some tips related to rebuilding the system when installing or upgrading modules, or upgrading Openbravo Core.
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:
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 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:
- First, the application is stable, and you should be able to restart Tomcat and login into Openbravo.
- However, some problems happened, and you should check them. You should see some hints in the Rebuild Window itself (in the section Warnings and Errors). However, you can search for the full log message by clicking on the "Show log" button. If you already closed the Rebuild Window, you can see the log files inside your Openbravo sources folder, in the "log" folder.
Here are some tips of what you could do in case there were warnings:
- If the warnings were in the "Database update" section of the rebuild, you should search for error messages in the "update.database" task execution in the log. It's most likely a problem related to Foreign Key constraints which were not activated for some reason, or other database objects not having been created. You should manually fix this problem by connecting to your database, and verifying why the foreign keys (or other database objects) couldn't be created. After you fix the problem, you should export your modules so that another rebuild doesn't cause the same problem.
- If the warnings happened in the "generating entities" step of the rebuild, you should manually call ant generate.entities and see what log do you get. This should give some tips on how to solve the problem.
- If the warnings happened in the "Source compilation" step, it's most likely a problem related to some java or xsql file. Check the log file to find out in which file the problem happened, and fix it. After you've fixed the problems, run ant smartbuild from the command line, and you should not see any more errors.
In case the build had 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:
- If the build stopped in the "Database update" step, most likely the database wasn't fully updated, and you will probably have problems logging into the application. You should look into the log to try to find which is the problem, fix it, and then do update.database so that the database is fully updated. Once this has been done, you can start a new build which should finish succesfully.
- If the build stopped in the "generating entities" step, you should do ant generate.entities. This could work, or if it doesn't, it should provide tips on what you should fix.
- If the build stopped in the "Source compilation" step, this is most likely related to some java or xsql file which contains errors. Try to find which file has problems by looking at the log messages, fix it, and then restart a build. If for some reason you cannot restart a build through the application, you can do a build by doing ant smartbuild in the command line.
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.
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.
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 if there're blocked objects
- Unlock them
- Re-run database update process and rebuild
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:
- Stop tomcat, this will stop the database update process.
- Try to kill the processes that are causing the block or restart the database service (PostgreSQL or Oracle).
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 -Dforce=yes
Known issues of past revisions of Openbravo
When updating from 2.50 MP10, an "Error checking access" is raised, but the build continues
In some (rare) cases when doing a rebuild of the system through the application, it could happen that the build raises an error, sometimes with the following message:
Error checking access
and/or complaining about a missing database object, with a message similar to this one:
Error: SQL error in query: SELECT ACCESSLEVEL FROM AD_FORM. Exception:org.postgresql.util.PSQLException: ERROR: relation "ad_table" does not exist
This error is shown due to a bug in 2.50MP10. The build process continues, and should finish correctly, even if the final shown message is the one of an error. If there are no further issues shown in the build, the build was indeed done correctly, and you have to execute the command ant smartbuild and restart your Tomcat server to access the application.