# metadatasharing module not working with core

**URL:** <https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528>\
**Category:** Development\
**Tags:** metadata-sharing\
**Created:** [March 20, 2020, 7:28pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528 "2020-03-20T19:28:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidvaish97](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sidvaish97/32/19702_2.png) [@sidvaish97](https://talk.openmrs.org/u/sidvaish97)\
**Post date:** [March 20, 2020, 7:28pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/1 "2020-03-20T19:28:55Z")

</div>

Logs [openmrs.txt](https://talk.openmrs.org/uploads/short-url/nEf14LqDxEwlbrUzO2vu1tAYDy3.txt) (1.2 MB)

I have figured out what’s wrong and tested it, the server runs after correcting that

`<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/> ` this need to be removed from `webModuleApplicationContext`

@dkayiwa

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 20, 2020, 7:55pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/2 "2020-03-20T19:55:32Z")

</div>

This is probably true of a number of other community-supported modules. We should probably create an Epic in Jira to track the removal of this from the community-supported modules. We do need to be on the look out for where the `DefaultAnnotationHandlerMapping` was being configured to do more than this and we need to make sure that all `@Controller`s have a corresponding `@RequestMapping`, but otherwise, I think it’s a safe change to make (OpenMRS 1.11.0 appears to be the last pre-Spring 4 version).

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 20, 2020, 9:52pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/3 "2020-03-20T21:52:34Z")

</div>

I’ve created [an Epic](https://issues.openmrs.org/browse/TRUNK-5722) for this. @dkayiwa Thanks for all your work on this!

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 22, 2020, 1:12pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/4 "2020-03-22T13:12:10Z")

</div>

Hello @ibacher, there are very many modules that are configured using this class,not only being them called as beans in webmoduleApplicationContext.xml file but also being called as a class. according to this [https://github.com/search?p=3&q=org%3Aopenmrs+DefaultAnnotationHandlerMapping&type=Code](https://github.com/search?p=3&q=org%3Aopenmrs+DefaultAnnotationHandlerMapping&type=Code). how can we go about this , Am guessing removing the DefaultAnnotationHandlerMpping class as it is stated would require to some files to be replaced by RequestMappingHandlerMapping class . More guidance will be highly appreciated thanks

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 22, 2020, 2:39pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/5 "2020-03-22T14:39:47Z")

</div>

@sharif I responded to this [on the Epic](https://issues.openmrs.org/browse/TRUNK-5722?focusedCommentId=262763&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-262763), since the information is relevant for actually solving it. Thanks for pointing out the potential ambiguities; I hope I’ve provided enough clarification.

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 22, 2020, 7:34pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/6 "2020-03-22T19:34:21Z")

</div>

Sure thanks for great clarification it was so helpful indeed

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [March 23, 2020, 7:04am UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/7 "2020-03-23T07:04:15Z")

</div>

@ibacher , Due to this backward incompatible change because of the Spring Upgrade , and the coming Java Upgrade , Our core should be bumped to Version 3.0 rather than 2.4.0  
cc @dkayiwa

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 23, 2020, 12:30pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/8 "2020-03-23T12:30:44Z")

</div>

@mozzy I don’t think there’s a change here that warrants a major version bump, but I understand the concern. Let me just clarify that the changes requested in the Epic will still be fully compatible with any version of OpenMRS Platform 2.x. Where things get a little muddy is with support for OpenMRS Platform 1.x. Versions of OpenMRS 1.12.0+ will be fully compatible with the change (remember the change we’re making reflects the state of things in Spring 3.2) but may be incompatible with OpenMRS 1.11.0 and lower. What this means is that some modules may become incompatible with OpenMRS 1.11.0 and lower and those _modules_ should probably have their major version incremented to signal this.

Regarding the bump in Java versions, although I don’t quite know what the status of this is, my position on it is we should move towards being compatible with Java 11 (the LTS release) without losing compatibility with Java 8, which again should keep the platform consistent with the OpenMRS 2.x series.

In my view, neither of these changes, either separately or combined, rise to the level of demanding a new OpenMRS version, however, I am, as always, willing to be contradicted on this.

FTR, I have no real _objection_ to bumping the platform to 3.0.0, I just think “modern Spring version and compatible with Java 11” is… not a major selling point.

cc: @burke @mseaton

---

<div class="post-metadata">

**Author:** ![mozzy](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mozzy/32/11815_2.png) [@mozzy](https://talk.openmrs.org/u/mozzy)\
**Post date:** [March 23, 2020, 12:35pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/9 "2020-03-23T12:35:35Z")

</div>

> [@ibacher](#):
>
> Let me just clarify that the changes requested in the Epic will still be fully compatible with any version of OpenMRS Platform 2.x.

@ibacher , thanks for the clarificaton on that point. At first it seemed to me that this change was nolonger compatible with the 2.x series 😉  
cool then …we can still go on with the 2.x

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 1:15pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/10 "2020-03-23T13:15:44Z")

</div>

> [@sidvaish97](#):
>
> `<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/> ` this need to be removed from `webModuleApplicationContext`

Have create a small PR [here](https://github.com/openmrs/openmrs-module-metadatasharing/pull/54) following the guidance from @ibacher and everything is right, The problem came to make metadatasharing module to depend on the current version of spring in openmrs core .

---

<div class="post-metadata">

**Author:** ![sidvaish97](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sidvaish97/32/19702_2.png) [@sidvaish97](https://talk.openmrs.org/u/sidvaish97)\
**Post date:** [March 23, 2020, 1:19pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/11 "2020-03-23T13:19:44Z")

</div>

@sharif I don’t think that only removing these line will solve the problem we’ll need to remove the mappings as well

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [March 23, 2020, 1:20pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/12 "2020-03-23T13:20:49Z")

</div>

I completely agree with @ibacher

The changes we are making to modules are completely backwards compatible. So no module will lose support for an old version of the platform that it supported.

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 1:27pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/13 "2020-03-23T13:27:05Z")

</div>

> [@sidvaish97](#):
>
> I don’t think that only removing these line will solve the problem we’ll need to remove the mappings as well

You are right but according to what @ibacher suggested, there are some modules that will not necessary removing this line but taking a key note of @controllers followed by @requestMappings.Removing that link didn’t encounter any error irrespective on controllers in the module.

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 1:35pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/14 "2020-03-23T13:35:44Z")

</div>

> [@dkayiwa](#):
>
> The changes we are making to modules are completely backwards compatible. So no module will lose support for an old version of the platform that it supported.

Thanks @dkayiwa i think thats why even the older support version of core in metadatasharing support the current upgrade of spring in core. Though running it encounters some [logs here](https://pastebin.com/P7NNL2zD) but they dont stop the success of the module

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 23, 2020, 1:48pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/15 "2020-03-23T13:48:05Z")

</div>

@sharif Could you turn that into two tickets for TRUNK please? One to fix these messages:

```auto
recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!

```

And one to address the exception:

```auto
schema export unsuccessful
org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-135]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
        at org.h2.message.DbException.get(DbException.java:167)
        at org.h2.message.DbException.get(DbException.java:144)
        at org.h2.message.DbException.get(DbException.java:133)
        at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1348)
        at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1323)
        at org.h2.jdbc.JdbcConnection.getAutoCommit(JdbcConnection.java:386)
        at com.mchange.v2.c3p0.impl.NewProxyConnection.getAutoCommit(NewProxyConnection.java:985)
        at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:82)
        at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
        at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:263)
        at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:229)
        at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:961)
        at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:251)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.destroy(LocalSessionFactoryBean.java:899)
        at org.openmrs.api.db.hibernate.HibernateSessionFactoryBean.destroy(HibernateSessionFactoryBean.java:192)
        at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:184)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:463)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:431)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
        at org.springframework.context.support.AbstractApplicationContext$3.run(AbstractApplicationContext.java:940)

```

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 2:41pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/16 "2020-03-23T14:41:58Z")

</div>

ok then i will create them , Can i add the Trunk-5722 among the link reference @ibacher ,i think this is not related in openmrs core, because the error logs provided were after running metadatasharing module. so this tickets may be under metadatasharing module

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [March 23, 2020, 3:00pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/17 "2020-03-23T15:00:22Z")

</div>

The exception points to this: `org.openmrs.api.db.hibernate.HibernateSessionFactoryBean.destroy`, which is part of core, hence where I went with that. But you’re right that the warning is probably generated from the metadata module itself.

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 3:03pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/18 "2020-03-23T15:03:07Z")

</div>

Thanks again @ibacher, let me create them however with clear description of how error logs came, then we will decide where they reside, i think its possible to shift them where they fall

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [March 23, 2020, 6:06pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/19 "2020-03-23T18:06:09Z")

</div>

Have created then [here](https://issues.openmrs.org/browse/META-372), and [here](https://issues.openmrs.org/browse/META-372) so would like for you review and also would recommend to reproduce the bug such that we can be on the same truck. Again if possible you can give me previlige to make them ready for work cc @dkayiwa @ibacher

---

<div class="post-metadata">

**Author:** ![mogoodrich](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mogoodrich/32/3324_2.png) [@mogoodrich](https://talk.openmrs.org/u/mogoodrich)\
**Post date:** [March 23, 2020, 9:00pm UTC](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528/20 "2020-03-23T21:00:34Z")

</div>

The issue here is that we’ve generally tried our hardest to avoid having to maintain multiple release branches of modules and backporting changes, etc.

So if I understand it, with this change we are saying that all modules would have to be bumped up to only support 1.12.x and above? If there’s an easy way to avoid having to do this, I’d like to do so.

[Next page](https://talk.openmrs.org/t/metadatasharing-module-not-working-with-core/27528.md?page=2)
