CMDBuild Forum

Copy of CMDBuild database cannot be used

I use one instance of cmdbuild (webapp 2.4.1 and postgres 9.4 database) for my development needs.

And I would like to periodically copy that database to another postgres server for production.

But after I copy my database (through pgAdmin backup and restore), the production webapp fails to initialize.

I get the message: "Domains should start with Map_"

Part of the stack trace is:

WARN  2016-10-25 16:11:50 [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

ERROR 2016-10-25 16:11:50 [org.springframework.web.context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)

...
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
...
Caused by: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.tableNameToDomainName(EntryTypeCommands.java:532)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:511)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:506)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
...
 
Dear Dimitri,
 
please execute this SQL query
 
SELECT domain_id, _cm_cmtable(domain_id) AS domain_name, _cm_cmschema(domain_id) as domain_schema, _cm_comment_for_table_id(domain_id) AS domain_comment
FROM _cm_domain_list() AS domain_id
WHERE domain_id <> '"Map"'::regclass
 
It should return all available domains. Between them you would find one which name has no "Map" prefix.
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitri wrote:

I use one instance of cmdbuild (webapp 2.4.1 and postgres 9.4 database) for my development needs.

And I would like to periodically copy that database to another postgres server for production.

But after I copy my database (through pgAdmin backup and restore), the production webapp fails to initialize.

I get the message: "Domains should start with Map_"

Part of the stack trace is:

WARN  2016-10-25 16:11:50 [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

ERROR 2016-10-25 16:11:50 [org.springframework.web.context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)

...
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
...
Caused by: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.tableNameToDomainName(EntryTypeCommands.java:532)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:511)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:506)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
...
 

 

Hi,
 
I ran the query and no table has another name. BUT as the query returned the set of domain names of ALL the schemas that exist in my database (I backuped up the "public" schema as "public_old" before restoring the data from my other postgres DB), the problem comes from that.
After deleting that extra schema, the problem disappears.
Thank you very much for helping on this.
 
I conclude that the database used by CMDBuild cannot have more than one postgresql schema. Will you consider refining the queries to avoid that constraint ?
 
Thanks again,

Dimitri
 
Previously Tecnoteca wrote:
Dear Dimitri,
 
please execute this SQL query
 
SELECT domain_id, _cm_cmtable(domain_id) AS domain_name, _cm_cmschema(domain_id) as domain_schema, _cm_comment_for_table_id(domain_id) AS domain_comment
FROM _cm_domain_list() AS domain_id
WHERE domain_id <> '"Map"'::regclass
 
It should return all available domains. Between them you would find one which name has no "Map" prefix.
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitri wrote:

I use one instance of cmdbuild (webapp 2.4.1 and postgres 9.4 database) for my development needs.

And I would like to periodically copy that database to another postgres server for production.

But after I copy my database (through pgAdmin backup and restore), the production webapp fails to initialize.

I get the message: "Domains should start with Map_"

Part of the stack trace is:

WARN  2016-10-25 16:11:50 [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

ERROR 2016-10-25 16:11:50 [org.springframework.web.context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)

...
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
...
Caused by: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.tableNameToDomainName(EntryTypeCommands.java:532)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:511)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:506)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
...
 

 

 

Dear Dimitri,
 
I conclude that the database used by CMDBuild cannot have more than one postgresql schema. Will you consider refining the queries to avoid that constraint ?
 
CMDBuild database can have more that one schema. Besides "public", one called "gis" is used for contain geometric data and one called "bim" is used for contain BIM related data. The problem is that tables within schemas different from "public", "gis" and "bim" should not have comments/metadata that would make them appear as entries of the CMDBuild model.
 
Anyway, we'll look for some way to avoid this problem.
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitri wrote:
Hi,
 
I ran the query and no table has another name. BUT as the query returned the set of domain names of ALL the schemas that exist in my database (I backuped up the "public" schema as "public_old" before restoring the data from my other postgres DB), the problem comes from that.
After deleting that extra schema, the problem disappears.
Thank you very much for helping on this.
 
I conclude that the database used by CMDBuild cannot have more than one postgresql schema. Will you consider refining the queries to avoid that constraint ?
 
Thanks again,

Dimitri
 
Previously Tecnoteca wrote:
Dear Dimitri,
 
please execute this SQL query
 
SELECT domain_id, _cm_cmtable(domain_id) AS domain_name, _cm_cmschema(domain_id) as domain_schema, _cm_comment_for_table_id(domain_id) AS domain_comment
FROM _cm_domain_list() AS domain_id
WHERE domain_id <> '"Map"'::regclass
 
It should return all available domains. Between them you would find one which name has no "Map" prefix.
 
Best regards.
 
-- CMDBuild Team
 
Previously Dimitri wrote:

I use one instance of cmdbuild (webapp 2.4.1 and postgres 9.4 database) for my development needs.

And I would like to periodically copy that database to another postgres server for production.

But after I copy my database (through pgAdmin backup and restore), the production webapp fails to initialize.

I get the message: "Domains should start with Map_"

Part of the stack trace is:

WARN  2016-10-25 16:11:50 [org.springframework.web.context.support.XmlWebApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

ERROR 2016-10-25 16:11:50 [org.springframework.web.context.ContextLoader] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxws.EndpointImpl--509787360': Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)

...
Caused by: javax.xml.ws.WebServiceException: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
        at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
...
Caused by: java.lang.IllegalArgumentException: Domains should start with Map_
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.tableNameToDomainName(EntryTypeCommands.java:532)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:511)
        at org.cmdbuild.dao.driver.postgres.EntryTypeCommands$3.mapRow(EntryTypeCommands.java:506)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
...