Is Sync module compatible with Platform 1.12.0?

Platform Version: 1.12.0

Question: I have downloaded in GitHub the open mrs core master 1.12.0 and I want to launch the sync module. The last is the 1.2 version, ant it requires Platform version 1.9. so I just begin in OpenMRS developing and I want to know if the sync module cannot be launched in Platform version 1.12.0. Or are there a process to adopt to allow it launching?

Requring Version 1.9 means that one must have at least version 1.9 - it is the minimum version supported. That being said, I don’t know whether anyone is successfully using Sync in any versions other than 1.9. At PIH we are running 1.9 in all implementations in which we use sync. Any testing on other Platform versions that you are able to do would be most welcome.

So you said that the version 1.9 is the high stable version of Platform in which sync module run well. Ok I think I will try to work with Platform 1.9 and if all is ok, I will continue with it.

Thank you.

Please @mseaton finally I deploy Platform 1.9.10 and the sync module works, but there is a problem. The problem is that the update on data already synchronized cannot be synchronized.

For example, if I create a patient, it will be synchronized but if after I add it to a program the program will not be synchronized.

Please do you have an idea on what is happening? And there is no error, they just said “ERROR - NOT SYNCHRONIZED, WILL RETRY” ever and ever.

You’ll need to check your log files for more possible information on the error - there’s not enough information here for anyone to know what’s going on. Please also look at the sync documentation on the wiki. There is a “Sync Bug Log” that is maintained there that describes some common sync errors, their symptoms, and their fixes.

I’d also mention that sync is not a module that you can expect to work seamlessly without frequent technical support and troubleshooting. You’ll generally need at least a working knowledge of the OpenMRS data model, how to read and interpret server log files, and the ability to use SQL as needed. I would advise taking this into account before going down the sync route.

The error is the next:

Could not save item for unknown reasons - could not insert: [org.openmrs.PatientProgram]:  
org.openmrs.module.sync.ingest.SyncIngestException: Could not save item for unknown reasons - could not insert: [org.openmrs.PatientProgram]
	at 
org.openmrs.module.sync.api.impl.SyncIngestServiceImpl.processOpenmrsObject(SyncIngestServiceImpl.java:565)

	at 
org.openmrs.module.sync.api.impl.SyncIngestServiceImpl.processSyncItem(SyncIngestServiceImpl.java:431)

	at [ignored] ...
	at com.sun.proxy.$Proxy155.processSyncItem(Unknown Source)
	at [ignored] ...
	at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:118)
	at [ignored] ...
	at com.sun.proxy.$Proxy156.processSyncItem(Unknown Source)
	at [ignored] ...
	at com.sun.proxy.$Proxy156.processSyncItem(Unknown Source)
	at 
org.openmrs.module.sync.api.impl.SyncIngestServiceImpl.processSyncRecord(SyncIngestServiceImpl.java:233)

	at [ignored] ...
	at com.sun.proxy.$Proxy155.processSyncRecord(Unknown Source)
	at [ignored] ...
	at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:118)
	at [ignored] ...
	at com.sun.proxy.$Proxy156.processSyncRecord(Unknown Source)
	at [ignored] ...
	at com.sun.proxy.$Proxy156.processSyncRecord(Unknown Source)
	at 
org.openmrs.module.sync.SyncUtilTransmission.processSyncTransmission(SyncUtilTransmission.java:495)

	at 
org.openmrs.module.sync.web.controller.ImportListController.processFormSubmission(ImportListController.java:303)

	at [ignored] ...
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)

	at 
org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:61)

	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)

	at 
org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)

	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:107)

	at [ignored] ...
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at [ignored] ...
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at [ignored] ...
	at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)

	at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
	at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

	at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
	at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
	at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)

	at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)

	at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)

	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)

	at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused
 by: org.hibernate.exception.ConstraintViolationException: could not 
insert: [org.openmrs.PatientProgram]
	at 
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)

	at 
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

	at 
org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)

	at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2345)

	at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2852)

	at 
org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)

	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
	at 
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320)

	at 
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)

	at 
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)

	at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)

	at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)

	at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)

	at 
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)

	at 
org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
	at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
	at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:673)
	at 
org.openmrs.module.sync.api.db.hibernate.HibernateSyncDAO.saveOrUpdate(HibernateSyncDAO.java:652)

	at 
org.openmrs.module.sync.api.impl.SyncServiceImpl.saveOrUpdate(SyncServiceImpl.java:588)

	at [ignored] ...
	at com.sun.proxy.$Proxy153.saveOrUpdate(Unknown Source)
	at [ignored] ...
	at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:118)
	at [ignored] ...
	at com.sun.proxy.$Proxy154.saveOrUpdate(Unknown Source)
	at [ignored] ...
	at com.sun.proxy.$Proxy154.saveOrUpdate(Unknown Source)
	at 
org.openmrs.module.sync.SyncUtil.updateOpenmrsObject(SyncUtil.java:707)
	at 
org.openmrs.module.sync.api.impl.SyncIngestServiceImpl.processOpenmrsObject(SyncIngestServiceImpl.java:560)

	... 123 more
Caused by: 
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
 Column 'program_id' cannot be null
	at [ignored] ...
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1041)
	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.executeUpdate(PreparedStatement.java:2441)

	at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2366)
	at 
com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2350)
	at 
com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
	at 
org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
	at 
org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
	... 177 more

And it is the same when you want to sync an encounter or an allergy.

I made a tour in the wiki and all the situation they describes don’t correspond to me. And if a patient and a program, his or not, are awaiting to be synchronized, none of them will be synchronized. But if you discard the program, the patient will be synchronized and that, that is what I don’t understand.

Thank you again for your help.

The part of the error that stands out is:

Caused by:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Column 'program_id' cannot be null

If you inspect the sync record, do you see anything missing that should be there? Is program referenced correctly?

@rubailly might be able to shed some light based on his experience…

1 Like

Ok thanks I will check that deepely.

Thanks Mr Seaton

I’ve seen this error before and the first thing to do here is to check if the Program referenced in the “PatientProgram” object exists on both the parent and the child server, and if the uuid’s are the same. It’s one of the situations where you get patient data missing the associated metadata. (…like trying to sync an encounter while the associated encounter type is not available on the destination server, or you want to sync an obs without syncing the associated concept first).

Try to stop the failing record and trigger sync for the referenced program (…for example, you can add something in the description and click save). Once the program has synced, reset the failing record as a new record.

1 Like