I encounter multiple errors upgrading from Platform 1.7 to Platform 1.9
See attached tomcat log:
What should be the correct procedure
- Have tried direct 1.7 to 1.9 upgrade
- Upgrade 1.7 - 1.8 then 1.9
Both dont work
Any suggestions ?
I encounter multiple errors upgrading from Platform 1.7 to Platform 1.9
See attached tomcat log:
What should be the correct procedure
Both dont work
Any suggestions ?
From the logs I see the following line
ERROR - Listener.contextInitialized(154) |2015-07-08 12:47:30,765| Got exception while starting up: java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set
It looks like you database credentials are not set correctly.
What exact version are you upgrading to?
VErsion 1.9.9
If not the password then it’s the user or the database.
Caused by: java.sql.SQLException: Access denied for user 'openmrs_user'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:917)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3974)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1282)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2292)
This is the root cause of this exception:
java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database. Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set
at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:578)
at org.openmrs.util.DatabaseUpdater.updatesRequired(DatabaseUpdater.java:257)
Subsequent errors are probably due to the fact that database changes haven’t been applied.
Judy can you connect to mysql using a command line client using the credentials you have in openmrs-runtime.properties file? Try running the following command and see what happens?
mysql -u <connection.username> -p <connection.password>
@willa i made a backup of the database and i am using my local mysql user and password to connect to it and that works
I did not try to connect with the previous password in the openmrs properties file
Judy
then make sure the connection.username & connection.password in openmrs-runtime.properties look exactly like whatever your local user & password combination you are using to connect to mysql respectively.
I deleted the properties file so i am sure its not the password
With @dkayiwa he thought the problem was at the obs table where the void_reason = htmlformentry
We checked the SQL version / troubleshooting
I have just made Null from the void reason and i am waiting to see if it skips this changeset or it works
Still taking lots of time
Maybe the runtime properties file Tomcat is using is not the one that you think?
Because when you delete the runtime properties file OpenMRS starts in installation mode and asks stuff about database, root user etc. Is this happening?
I personally think that the problem is caused by this changeset:
Which has this sql:
UPDATE obs, (SELECT obs_id AS previous_version,
REVERSE(SUBSTRING(REVERSE(SUBSTRING_INDEX(void_reason, ’ ', -1)), 2)) AS new_obs FROM obs) AS TMP_TAB SET obs.previous_version = TMP_TAB.previous_version WHERE obs.obs_id = TMP_TAB.new_obs;
Where REVERSE(SUBSTRING(REVERSE(SUBSTRING_INDEX(void_reason, ’ ', -1)), 2)) returns ‘htmlformentr’ instead of a number. So i think the changeset is buggy.
If you want to reproduce it, just run the sql below:
UPDATE obs, (SELECT obs_id AS previous_version, ‘htmlformentr’ AS new_obs FROM obs) AS TMP_TAB SET obs.previous_version = TMP_TAB.previous_version WHERE obs.obs_id != TMP_TAB.new_obs;
I haven’t run the query but I am baffled as to how this query would render username and/or password wrong? Is it possible that the error we see in the posted log file is misleading somehow?
When a user makes a number of attempts at something, the log file keeps track of the errors that they happened to get. When the errors are fixed, the log file does not clear them. So the trick is looking at the most recent.
There are 4 seconds between both exceptions, it looks like the same startup process. But certainly it connects to the DB otherwise the last one would not occur.
And there’s another exception in between:
Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE `concept_complex` (`concept_id` INT NOT NULL, `handler` VARCHAR(255) NULL, CONSTRAINT `PK_CONCEPT_COMPLEX` PRIMARY KEY (`concept_id`)): Table 'concept_complex' already exists
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
... 8 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'concept_complex' already exists
I deleted the column throwing an error
but then i run into a worse error
I would not recommend deleting any database columns. Can you temporarily stop the sync module and try again?
There are a lot of Spring errors, either it’s a bad build or something went wrong at deployment. Did you try a fresh mvn clean install ?