Task 'updateDb' failed

When i click in Database Update i get the next error: Task ‘updateDb’ failed, i see in the forum for resolve the error: Unexpected error
Please contact system administrator, i have to update the data base

Mysql 5.6 Community:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘10-cuba/update/mysql/16/160405-createUniqSysCategory.sql’ for key ‘PRIMARY’

Unexpected error:
2017-02-03 17:24:23.063 ERROR [http-nio-8080-exec-21] com.haulmont.cuba.web.AppUI - Unable to init ui
com.haulmont.cuba.security.global.LoginFailedException: Unable to obtain anonymous session with id 652d9283-af10-47c5-bdfc-e69cd7760093

Hi,

Could you please describe what you did?

It seems that you have created the project on the platform version 6.2 (or earlier) and then migrated it to 6.4. The updateDb task fails after migration. Right?

Do you use custom application components?

Also, try to launch Build->Clean in Studio and make one more attempt to update the database.

Let me explain how the updateDb task works:

  1. All the scripts are assembled in the ‘modules/core/build/db’ folder.
  2. For the selected DBMS Gradle executes all scripts except those which are already registered in the sys_db_changelog table.
  3. After the script execution new record appears in the sys_db_changelog table.

From your description, I assume that Gradle tries to register ‘10-cuba/update/mysql/16/160405-createUniqSysCategory.sql’ twice, for some unknown reason. So if the problem persists check the contents of the ‘modules/core/build/db/10-cuba/update/mysql/16’ folder and state of your DB and sys_db_changelog.

  1. Install Studio 6.5
  2. New Project
  3. Import Mysql Database two tables user and roles
  4. Run Project the sistema ask for database update and then i get the error.

Hi,

I still can not reproduce the problem. So could you please answer the following questions:

  1. Where did you get the DB? Is it a (legacy) database for some another system or have you created it with another CUBA project?

  2. Wow did you connect it? As main or additional data store?

  3. When you pressed “Generate model” did the system show a message with suggestion to update the database?

  4. Could you also share the whole message which appears in Studio when the task fails?

Problem solved, re-install everything from scratch
1 - OS.
2 - Mysql
2 - Cuba

Now is working