Trying to install CMDBuild and receiving an ORMException “ORM_GENERIC_ERROR”
CMDBuild is a free (“free” as in GPL v2) ITIL solution. The installation of the 2.3.1 version has been a pain in the ass. After applying the database information in the setup wizard, I always received an org.cmdbuild.exception.ORMException: ORM_GENERIC_ERROR. CMDBuild stores its log files (cmdbuild.log, cmdbuild_dd_sql.log) in the “logs” folder of Tomcat where I could find the root cause for this issue. Our PostgreSQL instance is installed on a Windows machine and holds two database templates. template0 has UTF-8 default encoding, template1 uses WIN-1252. During the installation of the database schema of CMDBuild, the template1 is used. The WIN-1252 encoding of template1 is not compatible with the used UTF-8 encoding of CMDBuild/Java. I fixed this issue by re-creating the template1 schema with UTF-8:
DROP DATABASE template1;
CREATE DATABASE template1 WITH template = template0 ENCODING = 'UTF8';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
The next time I hit the install button of the wizard, I received another ORM_GENERIC_ERROR. This time the log stated that the plpgsql language was missing for template1. I altered the template1 by issuing a “CREATE LANGUAGE plpgsql”. After that I was able to install CMDBuild.