ClassNotFoundException when loading moduleApplicationContext 1.10.4

I have the following configuration in one of our moduleApplicationContext files:

<bean id="obsInmemoryDataSource" class="org.openmrs.module.chirdlutilbackports.datasource.ObsInMemoryDatasource">
    <property name="logicObsInMemoryDAO"><ref bean="logicInMemoryObsDAO"></ref></property>

This configuration worked fine up until the switch from 1.9.10 to 1.10.4. Now I get the following error and the module will not load:

org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.openmrs.module.chirdlutilbackports.datasource.ObsInMemoryDatasource] for bean with name ‘obsInmemoryDataSource’ defined in URL [jar:file:/C:/Program%20Files/tomcat_upgrade/temp/1463597649611.openmrs-lib-cache/chirdlutilbackports/chirdlutilbackports.jar!/moduleApplicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/openmrs/logic/datasource/ObsDataSource

The class it can’t find is in the logic module which is in a bundledModules directory that I added when I built Openmrs 1.10.4 on my local machine. I verified that the module is located in APACHE_HOME\webapps\openmrs\WEB-INF\bundledModules. I looked in the omod file and the class is definitely there. Why can it still not find the class?

I believe it is because Logic is no longer a required module in later releases. You’ll need to declare an explicit dependency on logic in the require_modules section of your config.xml file in your chirdlutilbackports module.


Thanks, Mike. I’ll try that.

That did the trick. Thanks.