CMDBuild Forum

Upgrading CMDBuild, Patch Magager lists all patches, even those already applied

I'm trying to upgrade from CMDBuild 1.2.3 to 2.2.1
 
Whenever I run the application, the "List of available patches" in the "Patch Manager" lists every patch (from 1.0.3-01 onwards) instead of listing only not yet applied patches. When I click on "Apply", it gives an error. This is part of the cmdbuild.log after the error:
 
INFO  2014-09-26 16:11:53 [cmdbuild] Number of fetched patches: 90
INFO  2014-09-26 16:11:53 [cmdbuild] Last patch D:\Tomcat4\webapps\cmdbuild\WEB-INF\patches\2.2.1-01.sql
INFO  2014-09-26 16:11:53 [cmdbuild] Last available patch is 2.2.1-01
INFO  2014-09-26 16:12:04 [jsonrpc ] Calling url /utils/gettranslationobject
INFO  2014-09-26 16:12:05 [jsonrpc ] Calling url /configure/getpatches
INFO  2014-09-26 16:14:00 [jsonrpc ] Calling url /configure/applypatches
INFO  2014-09-26 16:14:00 [cmdbuild] Applying patch 1.0.3-01
ERROR 2014-09-26 16:14:02 [jsonrpc ] A java.lang.NullPointerException occurred calling method class org.cmdbuild.servlets.json.Configure.applyPatches
INFO  2014-09-26 16:14:02 [jsonrpc ] Calling url /configure/getpatches
 
Why the application is trying to apply from the first patch?
If I apply the patches manually, they run without problem. The last row in the table "Patch" is:
 
     194035;""Patch"";"1.2.3-03";"Function and trigger massive update (might take a long time)";"A";"system";"2014-09-26 17:50:00.748"
 
(I applied the patches 1.2.3-01 to 03 manually, and inserted the corresponding rows in the "Patch" table).
 
Thanks in advance,
Regards,
Fabricio
Hi, 
this is a know problem trying to update directly from a version prior to 1.4 to the 2.2.
You can avoid this behaviour executing the following function in your database, and stopping and starting again the tomcat.
Here it is the SQL function: 
 
CREATE OR REPLACE FUNCTION public._cm_parent_id(tableid oid) RETURNS SETOF oid AS $$
SELECT COALESCE((SELECT inhparent FROM pg_inherits WHERE inhrelid = $1 AND _cm_is_cmobject(inhparent) LIMIT 1), NULL);
$$ LANGUAGE sql VOLATILE;
 
Best regards, 
the CMDBuild Team
 
Hi, thank you very much for your quick response. 
What I did was to update first to 1.4 and then to 2.2, which worked smoothly. 
 
Best regards, 
Fabricio.