Setting up OpenMRS Reference Application 2.8.0 on Ubuntu 18.04

I am trying to install Reference Application 2.8.0 on Ubuntu 18.04.

Tomcat Version: Apache Tomcat/8.5.30 (Ubuntu) JVM Version: 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11 OS Name: Linux OS Version: 4.15.0-23-generic OS Architecture: amd64

I sucessfully installed Platform 2.1.3 with no modules. I can load the following Reference application modules without error:

addresshierarchy-2.11.0.omod appointmentscheduling-1.9.0.omod atlas-2.2.omod calculation-1.2.omod dataexchange-1.3.2.omod emrapi-1.24.4.omod event-2.6.0.omod fhir-1.13.0.omod htmlformentry-3.7.0.omod htmlwidgets-1.9.0.omod idgen-4.5.0.omod legacyui-1.4.0.omod metadatadeploy-1.10.0.omod metadatamapping-1.3.4.omod metadatasharing-1.5.0.omod owa-1.9.0.omod providermanagement-2.10.0.omod registrationcore-1.8.0.omod reporting-1.16.0.omod reportingcompatibility-2.0.5.omod reportingrest-1.10.0.omod serialization.xstream-0.2.14.omod uicommons-2.6.0.omod uiframework-3.13.0.omod uilibrary-2.0.6.omod webservices.rest-2.22.0.omod

However, after adding referencemetadata-2.8.0.omod I get the warning and error show below in the logs. It looks to me like a MySQL problem with character sets. The MySQL version is: Server version: 5.7.22-0ubuntu18.04.1 (Ubuntu) Has anyone seen this before? have any suggestions?

WARN - AbstractTableMetaData.getDataTypeFactory(166) |2018-07-10 13:01:07,067| Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' (e.g. some datatypes may not be supported properly). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
WARN - AbstractTableMetaData.getDataTypeFactory(166) |2018-07-10 13:01:07,103| Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' (e.g. some datatypes may not be supported properly). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
WARN - AbstractTableMetaData.getDataTypeFactory(166) |2018-07-10 13:01:07,115| Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' (e.g. some datatypes may not be supported properly). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
WARN - AbstractTableMetaData.getDataTypeFactory(166) |2018-07-10 13:01:07,223| Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' (e.g. some datatypes may not be supported properly). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
WARN - AbstractTableMetaData.getDataTypeFactory(166) |2018-07-10 13:01:07,240| Potential problem found: The configured data type factory 'class org.dbunit.dataset.datatype.DefaultDataTypeFactory' might cause problems with the current database 'MySQL' (e.g. some datatypes may not be supported properly). In rare cases you might see this message because the list of supported database products is incomplete (list=[derby]). If so please request a java-class update via the forums.If you are using your own IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override getValidDbProducts() to specify the supported database products.
WARN - ModuleUtil.refreshApplicationContext(941) |2018-07-10 13:01:07,267| Unable to invoke started() method on the module's activator
java.lang.RuntimeException: java.sql.SQLException: Incorrect string value: '\xDA\xA9\xD8\xB3\xDB\x8C...' for column 'description' at row 1
	at org.openmrs.module.dataexchange.DataImporter.importData(DataImporter.java:71)
	at org.openmrs.module.dataexchange.DataImporter$1.execute(DataImporter.java:44)
	at org.hibernate.jdbc.WorkExecutor.executeWork(WorkExecutor.java:54)
	at org.hibernate.internal.SessionImpl$2.accept(SessionImpl.java:2076)
	at org.hibernate.internal.SessionImpl$2.accept(SessionImpl.java:2073)
	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:313)
	at org.hibernate.internal.SessionImpl.doWork(SessionImpl.java:2095)
	at org.hibernate.internal.SessionImpl.doWork(SessionImpl.java:2080)
	at org.openmrs.api.db.hibernate.DbSession.doWork(DbSession.java:1005)
	at org.openmrs.module.dataexchange.DataImporter.importData(DataImporter.java:42)
	at org.openmrs.module.dataexchange.DataImporter$$FastClassBySpringCGLIB$$572a80f.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
	at org.openmrs.module.dataexchange.DataImporter$$EnhancerBySpringCGLIB$$bd550831.importData(<generated>)
	at org.openmrs.module.referencemetadata.ReferenceMetadataActivator.installConcepts(ReferenceMetadataActivator.java:95)
	at org.openmrs.module.referencemetadata.ReferenceMetadataActivator.started(ReferenceMetadataActivator.java:61)
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:933)
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:866)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:656)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:635)
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:266)
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)
Caused by: java.sql.SQLException: Incorrect string value: '\xDA\xA9\xD8\xB3\xDB\x8C...' for column 'description' at row 1
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:823)
	at org.dbunit.database.statement.SimplePreparedStatement.addBatch(SimplePreparedStatement.java:80)
	at org.dbunit.operation.RefreshOperation$RowOperation.execute(RefreshOperation.java:183)
	at org.dbunit.operation.RefreshOperation$InsertRowOperation.execute(RefreshOperation.java:249)
	at org.dbunit.operation.RefreshOperation.execute(RefreshOperation.java:112)
	at org.openmrs.module.dataexchange.DataImporter.importData(DataImporter.java:65)
	... 27 more
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 13:01:08,224| Line=362 The content of element type "dwr" must match "(init?,allow?,signatures?)".
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 13:01:08,228| Parameter mismatch parsing signatures section in dwr.xml on line: DWRAtlasService.disableAtlasModule()
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 13:01:08,236| Parameter mismatch parsing signatures section in dwr.xml on line: DWRHtmlFormEntryService.checkIfLoggedIn()

Maybe you need to try Mysql 5.6

Hi @tansentim

Seems like, this is the problem with your MySQL Server. Actually mentioned value in the error stack ("’\xDA\xA9\xD8\xB3\xDB\x8C…’") is a unicode content. So it may require some specific alterations in your server.

Did you check this solution about your problem? Let’s try it.

MySQL 5.7 should work fine with the latest release of the reference application. I would cross check the database character set and collation.

Thank you. I just added the following file to the configuration of MySQL in /etc/mysql/conf.d/charset.cnf

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci

I then dropped the old database, and re-created it.

That fixed the previous error, but now I get a new one. Any suggestions?

WARN - ModuleUtil.refreshApplicationContext(941) |2018-07-10 15:37:02,031| Unable to invoke started() method on the module's activator
org.openmrs.api.APIException: Unable to install bundle RolePrivilegeMetadata
	at org.openmrs.module.metadatadeploy.api.impl.MetadataDeployServiceImpl.installBundle(MetadataDeployServiceImpl.java:117)
	at org.openmrs.module.metadatadeploy.api.impl.MetadataDeployServiceImpl.installBundles(MetadataDeployServiceImpl.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
	at com.sun.proxy.$Proxy772.installBundles(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
	at com.sun.proxy.$Proxy896.installBundles(Unknown Source)
	at org.openmrs.module.referencemetadata.ReferenceMetadataActivator.deployMetadataPackages(ReferenceMetadataActivator.java:125)
	at org.openmrs.module.referencemetadata.ReferenceMetadataActivator.started(ReferenceMetadataActivator.java:64)
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:933)
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:866)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:656)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:635)
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:266)
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)
Caused by: org.openmrs.module.metadatadeploy.MissingMetadataException: No such Privilege with identifier 'App: appointmentschedulingui.home'
	at org.openmrs.module.metadatadeploy.MetadataUtils.existing(MetadataUtils.java:56)
	at org.openmrs.module.metadatadeploy.bundle.CoreConstructors$2.transform(CoreConstructors.java:533)
	at org.apache.commons.collections.CollectionUtils.collect(CollectionUtils.java:632)
	at org.apache.commons.collections.CollectionUtils.collect(CollectionUtils.java:610)
	at org.openmrs.module.metadatadeploy.bundle.CoreConstructors.role(CoreConstructors.java:530)
	at org.openmrs.module.metadatadeploy.bundle.CoreConstructors.role(CoreConstructors.java:550)
	at org.openmrs.module.referencemetadata.RolePrivilegeMetadata.install(RolePrivilegeMetadata.java:147)
	at org.openmrs.module.metadatadeploy.api.impl.MetadataDeployServiceImpl.installBundle(MetadataDeployServiceImpl.java:111)
	... 35 more
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 15:37:03,278| Line=362 The content of element type "dwr" must match "(init?,allow?,signatures?)".
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 15:37:03,281| Parameter mismatch parsing signatures section in dwr.xml on line: DWRAtlasService.disableAtlasModule()
ERROR - CommonsLoggingOutput.error(75) |2018-07-10 15:37:03,288| Parameter mismatch parsing signatures section in dwr.xml on line: DWRHtmlFormEntryService.checkIfLoggedIn()

Does this mean that the metadatadeploy should depend on appointmentshedulingui ?

Are all modules started and running?

Here are the things I did to have OpenMRS Reference Application running on Ubuntu 18.04

Tomcat by default runs on JVM 10.0.1+10-Ubuntu-3ubuntu1. OpenMRS did not work with that version, so I changed this to 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11 with the following coomands. (The problem seems to be with the spring framework and modules, as the install without modules worked fine with JVM 10).

update-alternatives --config java

and since that did not change the runtime version of tomcat8 I also did the following:

cd /usr/lib/jvm
mv default-java orig-default-java
ln -s java-1.8.0-openjdk-amd64 default-java

I then created the directory for the OpenMRS configuration.

mkdir /var/lib/OpenMRS
chown tomcat8:tomcat8 /var/lib/OpenMRS

I added a file to make MySQL default to utf-8:

/etc/mysql/conf.d/charset.cnf

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci

and then restarted mysql.

Using the mysql client I created a database and a user to use the database (although I think the reference application may be able to do this if you can give the mysql admin password to the installer):

create database openmrs ;
grant all on openmrs.* to 'openmrs_user'@'%' identified by '********';

I copied the openmrs.war from the download site (https://openmrs.org/download/). That was version 2.1.3.

I copied the reference application addons from the download site. Version 2.8.0. I then expanded the zip file, and placed the modules into /var/lib/OpenMRS/modules and the owas into /var/lib/OpenMRS/owa

Maybe this might help you @agk as well. It took some time to isolate what worked and what did not.

1 Like

@tansentim have you also tried using Oracle jdk8 instead of OpenJDk 8 ?

Thanks @tansentim for sharing! :smile:

I was thinking of including it somewhere in our documentation? What is your view? Thanks @tansentim

I did not try that. I already had the openjdk 8 package installed, so I just tried that and it seemed to work.

1 Like

@jwnasambu I think that having an installation page for OpenMRS on Ubuntu would be good. It might need some extra fleshing out with the ubuntu packages that are needed and that many of the commands in my original post needed sudo.

sudo apt install openjdk-8-jdk
sudo apt install tomcat8 tomcat8-admin
sudo apt install mysql-server mysql-client

@tansentim do you think you can create such a guide? :slight_smile: