cancel
Showing results for 
Search instead for 
Did you mean: 

DataBase Upgrade doesn't work!

rkoehler
Champ in-the-making
Champ in-the-making
Hey,
we work with Activiti 5.1 and now i want to upgrade to Activiti 5.2 and i have trouble with upgrading the database.
I modified the build.properties to point to my existing database. Then i executed ant cfg.create and modified the activiti.cfg.xml in setup\build\activiti-cfg
Then i started ant demo.start and get the Error:

internal.db.create.engine:
      [sql] Executing resource: org/activiti/db/create/activiti.mysql.create.sql
      [sql] Failed to execute:  create table ACT_GE_PROPERTY ( NAME_ varchar(64), VALUE_ varchar(300), REV_ integer, primary key (NAME_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin

BUILD FAILED
/home/SAXOPRINT/rkoehler/tools/activiti-5.2/setup/build.xml:155: The following error occurred while executing this line:
/home/SAXOPRINT/rkoehler/tools/activiti-5.2/setup/build.xml:195: The following error occurred while executing this line:
/home/SAXOPRINT/rkoehler/tools/activiti-5.2/setup/build.xml:205: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ACT_GE_PROPERTY' already exists

What i'm doing wrong. Or what is the best way to update Activiti?!

THX!
10 REPLIES 10

jcosano
Champ in-the-making
Champ in-the-making
do you put in your configuration file the property databaseSchemaUpdate?


<property name="databaseSchemaUpdate" value="true" />

rkoehler
Champ in-the-making
Champ in-the-making
Yes… i did.
After i created the config with ant cfg.create i modified the  setup\build\activiti-cfg\activiti.cfg.xml and also the activiti.cfg.xml in the setup\build\activiti-cfg.jar.
This is my modified activiti.cfg.xml (i have removed the connectionsettings):

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
 
    <!– Database configurations –>
    <property name="databaseType" value="mysql" />
    <property name="jdbcUrl" value="jdbc:mysql://CONNSTRING" />
    <property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUsername" value="USERNAME" />
    <property name="jdbcPassword" value="PASSWORD" />
    <property name="databaseSchemaUpdate" value="true" />
   
  </bean>

</beans>

frederikherema1
Star Contributor
Star Contributor
Hi,

The activiti demo creates the tables in the DB itself, before actually starting the engine. The upgrade procedure only kicks in when the engine itself is started on an existing database.

Kind regards,
Frederik

rkoehler
Champ in-the-making
Champ in-the-making
Ok tried the following.
1. I stopped my activiti-5.1 instance.
2. Then i started a new activiti-5.2 setup with h2 database. After demo.setup i configured the activiti.cfg.jar to point to my old 5.1 Database.
3. Then i restarted the 5.2 Tomcat-Server and login for example works. But the database was not correctly updated cause the following error occured after login to Activiti Cycle:

11:11:44,416  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 01040000 Wrapped Exception (with status template): Cannot create instance of component 'org.activiti.cycle.impl.components.RuntimeConnectorList' of type 'class org.activiti.cycle.impl.components.RuntimeConnectorList':
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
### The error may involve org.activiti.cycle.selectRepositoryConnectorConfigurationByGroup-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
org.springframework.extensions.webscripts.WebScriptException: 01040000 Wrapped Exception (with status template): Cannot create instance of component 'org.activiti.cycle.impl.components.RuntimeConnectorList' of type 'class org.activiti.cycle.impl.components.RuntimeConnectorList':
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
### The error may involve org.activiti.cycle.selectRepositoryConnectorConfigurationByGroup-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:167)
        at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.RuntimeException: Cannot create instance of component 'org.activiti.cycle.impl.components.RuntimeConnectorList' of type 'class org.activiti.cycle.impl.components.RuntimeConnectorList':
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
### The error may involve org.activiti.cycle.selectRepositoryConnectorConfigurationByGroup-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
        at org.activiti.cycle.CycleComponentFactory.createInstance(CycleComponentFactory.java:199)
        at org.activiti.cycle.CycleComponentFactory.getComponentInstance(CycleComponentFactory.java:140)
        at org.activiti.cycle.CycleComponentFactory.getComponentInstance(CycleComponentFactory.java:125)
        at org.activiti.cycle.CycleComponentFactory.getCycleComponentInstance(CycleComponentFactory.java:387)
        at org.activiti.cycle.context.CycleSessionContext.get(CycleSessionContext.java:43)
        at org.activiti.cycle.context.CycleSessionContext.get(CycleSessionContext.java:25)
        at org.activiti.cycle.context.CycleSessionContext.get(CycleSessionContext.java:54)
        at org.activiti.cycle.impl.service.CycleRepositoryServiceImpl.getRuntimeRepositoryConnectors(CycleRepositoryServiceImpl.java:67)
        at org.activiti.cycle.impl.service.CycleRepositoryServiceImpl.getRepoRootFolders(CycleRepositoryServiceImpl.java:92)
        at org.activiti.cycle.impl.service.CycleRepositoryServiceImpl.getChildren(CycleRepositoryServiceImpl.java:83)
        at org.activiti.rest.api.cycle.TreeGet.execute(TreeGet.java:40)
        at org.activiti.rest.api.cycle.ActivitiCycleWebScript.executeWebScript(ActivitiCycleWebScript.java:59)
        at org.activiti.rest.util.ActivitiWebScript.executeImpl(ActivitiWebScript.java:68)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
        … 17 more
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
### The error may involve org.activiti.cycle.selectRepositoryConnectorConfigurationByGroup-Inline
### The error occurred while setting parameters
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:61)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:53)
        at org.activiti.cycle.impl.db.impl.CycleDaoMyBatisImpl.selectRepositoryConnectorConfigurationByGroup(CycleDaoMyBatisImpl.java:323)
        at org.activiti.cycle.impl.db.impl.CycleDaoMyBatisImpl.getRepositoryConnectorConfigurationsForUser(CycleDaoMyBatisImpl.java:267)
        at org.activiti.cycle.impl.service.CycleConfigurationServiceImpl.getConnectorConfigurations(CycleConfigurationServiceImpl.java:96)
        at org.activiti.cycle.impl.components.RepositoryConnectorFactory.getConnectors(RepositoryConnectorFactory.java:29)
        at org.activiti.cycle.impl.components.RuntimeConnectorList.init(RuntimeConnectorList.java:52)
        at org.activiti.cycle.impl.components.RuntimeConnectorList.<init>(RuntimeConnectorList.java:30)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at java.lang.Class.newInstance0(Class.java:372)
        at java.lang.Class.newInstance(Class.java:325)
        at org.activiti.cycle.CycleComponentFactory.createInstance(CycleComponentFactory.java:197)
        … 30 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'activiti51.ACT_CY_CONN_CONFIG' doesn't exist
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:995)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:39)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:55)
        at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:41)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:94)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:72)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:59)
        … 44 more
What i'm doing wrong?!

meyerd
Champ on-the-rise
Champ on-the-rise
Hi rkoehler,

The update fails on the cycle db tables. Activiti-cycle is still in "beta" and we do not provide automatic migration/update (yet). From activiti-5.1 to activiti-5.2 the cycle db schema layout changed.

what you could try drop/create the cycle db tables. The following SQLs should do the trick (WARNING: you loose you cycle configuration):


drop table ACT_CY_CONFIG;

create table ACT_CY_CONN_CONFIG (
ID_ varchar(255) NOT NULL,
PLUGIN_ID_ varchar(255) NOT NULL,
INSTANCE_NAME_ varchar(255) NOT NULL,
INSTANCE_ID_ varchar(255) NOT NULL, 
USER_ varchar(255),
GROUP_ varchar(255),
VALUES_ text,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;

create table ACT_CY_CONFIG (
ID_ varchar(255) NOT NULL,
GROUP_ varchar(255) NOT NULL,
KEY_ varchar(255) NOT NULL,
VALUE_ varchar(255) NOT NULL,
primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;

(assuming you are on mysql)

then you could add a connector-configuration for kermit:


insert into ACT_CY_CONN_CONFIG values ('1',
    'org.activiti.cycle.impl.connector.fs.FileSystemConnector',
    'Eclipse Workspace (File System)',
    'Workspace',
    'kermit', '',
    '<map><entry><string>basePath</string><string>/path/to/your/eclipse/workspace</string></entry></map>');
insert into ACT_CY_CONN_CONFIG values ('2',
    'org.activiti.cycle.impl.connector.signavio.SignavioConnector',
    'Activiti Modeler',
    'Activiti',
    'kermit', '',
    '<map>
     <entry><string>signavioBaseUrl</string><string>http://localhost:8080/activiti-modeler/</string></entry>
     <entry><string>loginRequired</string><boolean>false</boolean></entry>
    </map>');

I hope this works for you. If not, plz ask back.

Regards,
Daniel

wolpert
Champ in-the-making
Champ in-the-making
I did try the above, but it fails here:

01100004 Wrapped Exception (with status template):
   ### Error querying database. Cause: org.postgresql.util.PSQLException: ERROR: relation "act_cy_tag" does not exist
    Position: 15
   ### The error may involve org.activiti.cycle.selectTagsForNode-Inline
   ### The error occurred while setting parameters
   ### Cause: org.postgresql.util.PSQLException: ERROR: relation "act_cy_tag" does not exist
    Position: 15

wolpert
Champ in-the-making
Champ in-the-making
FYI, I ended up just reloading the original schema for the other missing act_cy_* tables and got it running.

It is strange to me that the SQL for the schema doesn't exist in the create location…

http://svn.codehaus.org/activiti/activiti/tags/activiti-5.2/modules/activiti-engine/src/main/resourc...

Are their other tables not created through this schema? (Or did I just miss them?)

frederikherema1
Star Contributor
Star Contributor
Hi,

The cycle-tables create-statements are in the activiti-cycle module:
http://svn.codehaus.org/activiti/activiti/tags/activiti-5.2/modules/activiti-cycle/src/main/resource...

In 5.3, the DB-create/update/drop mechanism will be slightly different, so cycle-tables aren't treated any different from engine-tables.

meyerd
Champ on-the-rise
Champ on-the-rise
So I gather this is solved? I not, or if you need further assistance, ask again.

Regards,
Daniel