RefApp Standalone: Failed to read candidate component class

Application Name: Reference Application Standalone Version Number: 2.3.1

Question: Hello Friends I successfully installed Reference Application 2.3.1 Standalone Edition, but the server failed to completely load the page to the browser. What could be the problem? Below is the error:

The following error occurred at startup:
Failed to read candidate component class: URL [jar:file:/C:/Users/kiiza/Desktop/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/kiiza/Desktop/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)
	at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
	at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)
	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
	at org.openmrs.web.Listener.contextInitialized(Listener.java:177)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
	at org.openmrs.standalone.TomcatManager.run(TomcatManager.java:97)
	at org.openmrs.standalone.ApplicationController.startServer(ApplicationController.java:420)
	at org.openmrs.standalone.ApplicationController.access$000(ApplicationController.java:32)
	at org.openmrs.standalone.ApplicationController$1.construct(ApplicationController.java:142)
	at org.openmrs.standalone.SwingWorker$2.run(SwingWorker.java:125)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException
	at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:56)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:76)
	at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:105)
	at org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter.match(AbstractTypeHierarchyTraversingFilter.java:76)
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:333)
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:267)
	... 35 more
Caused by: java.lang.IllegalArgumentException
	at org.springframework.asm.ClassReader.(Unknown Source)
	at org.springframework.asm.ClassReader.(Unknown Source)
	at org.springframework.asm.ClassReader.(Unknown Source)
	at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:53)
	... 42 more

Hi @tendomart, I encountered this error recently, in my opinion it’s caused by incompatible Java version. Could you provide details about what JDK version you have installed? In my case, switching from 1.8 to 1.7 solved the problem.

If case you have installed two versions, you can run server by specify the exact location of JDK1.7:

  • For UNIX systems: edit run-on-unix.sh script and replace java for "C:\Path_to_your_jdk_location\Java\jdk1.7.0_79\bin\java.exe"

  • For Windows:

  1. Open the Command Prompt cmd
  2. Copy path to directory with OpenMRS standalone server
  3. Move to that location cd C:\path_to_our_openmrs
  4. Run it with "C:\Path_to_your_jdk_location\Java\jdk1.7.0_79\bin\java.exe" -jar openmrs-standalone.jar
1 Like

Hello Tendo,

Have you tried the solution proposed and did it work?

I ran into the same problem:

"Failed to read candidate component class: URL [jar:file:/C:/Users/FSHD/Documents/OpenMRS_231/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn’t supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/FSHD/Documents/OpenMRS_231/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is …"

Kayode

Dear Leszek,

I tried it and it did not work for me:

"Failed to read candidate component class: URL [jar:file:/C:/Users/FSHD/Documents/OpenMRS_231/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn’t supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL [jar:file:/C:/Users/FSHD/Documents/OpenMRS_231/openmrs-standalone-2.3.1/openmrs-standalone.jar!/org/openmrs/standalone/MainFrame.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn’t supported yet: class path resource [javax/swing/JFrame.class]; nested exception is java.lang.IllegalArgumentException at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290) at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242) at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)…"

I am using JAVA_VERSION=“1.8.0_91” in Windows 10.

Thanks.

Kayode

Dear All,

Tried running Standalone 2.3.1 with Java7u80 without any success as well:

"OpenMRS is not able to start.
The following error occurred at startup:
Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSourceServiceTarget' defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean 'mutableResourceBundleMessageSource' while setting bean property 'activeMessageSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mutableResourceBundleMessageSource' defined in class path resource [applicationContext-service.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor#0' defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean 'transactionInterceptor' while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionInterceptor' defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-service.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Unable to instantiate custom type: org.openmrs.module.metadatasharing.api.db.hibernate.XMLSerializableType Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registrationCoreService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/registrationcore/lib/registrationcore-api-1.2.jar!/moduleApplicationContext.xml]: Cannot create inner bean 'org.openmrs.module.registrationcore.api.impl.RegistrationCoreServiceImpl#5c74a0' of type [org.openmrs.module.registrationcore.api.impl.RegistrationCoreServiceImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.registrationcore.api.impl.RegistrationCoreServiceImpl#5c74a0' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/registrationcore/lib/registrationcore-api-1.2.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'registrationCoreDAO' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registrationCoreDAO' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/registrationcore/lib/registrationcore-api-1.2.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'htmlFormEntryService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/htmlformentry/lib/htmlformentry-api-2.6.jar!/moduleApplicationContext.xml]: Cannot create inner bean 'org.openmrs.module.htmlformentry.impl.HtmlFormEntryServiceImpl#422965' of type [org.openmrs.module.htmlformentry.impl.HtmlFormEntryServiceImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.htmlformentry.impl.HtmlFormEntryServiceImpl#422965' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/htmlformentry/lib/htmlformentry-api-2.6.jar!/moduleApplicationContext.xml]: Cannot create inner bean 'org.openmrs.module.htmlformentry.db.hibernate.HibernateHtmlFormEntryDAO#15699f0' of type [org.openmrs.module.htmlformentry.db.hibernate.HibernateHtmlFormEntryDAO] while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.openmrs.module.htmlformentry.db.hibernate.HibernateHtmlFormEntryDAO#15699f0' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/htmlformentry/lib/htmlformentry-api-2.6.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleLabEntryService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/simplelabentry/simplelabentry.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/openmrs/api/OrderService$ORDER_STATUS Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleLabEntryService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/simplelabentry/simplelabentry.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/openmrs/api/OrderService$ORDER_STATUS Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleLabEntryService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/simplelabentry/simplelabentry.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/openmrs/api/OrderService$ORDER_STATUS Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleLabEntryService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/simplelabentry/simplelabentry.jar!/moduleApplicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/openmrs/api/OrderService$ORDER_STATUS Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conditionService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/emrapi/lib/emrapi-condition-list-1.11.1.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'conditionServiceTarget' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conditionServiceTarget' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/emrapi/lib/emrapi-condition-list-1.11.1.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'conditionDAO' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conditionDAO' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/emrapi/lib/emrapi-condition-list-1.11.1.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reportingSerializedDefinitionService' defined in URL [jar:file:/C:/Users/FSHD/AppData/Local/Temp/1461407653085.openmrs-lib-cache/reporting/reporting.jar!/moduleApplicationContext.xml]: Cannot create inner bean 'org.openmrs.module.reporting.definition.service.SerializedDefinitionServiceImpl#50e330' of type [org.openmrs.module.reporting.definition.service.SerializedDefinitionServiceImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with ..."

Any suggestions as to what to do next to get the it to run on Windows 10?

Kayode

In your error messages i see the simplelabentry module which is not part of the reference application. This makes me suggest that do a fresh unzipping of the standalone and run it again.

Dear Daniel,

I downloaded a fresh package and it worked without any error.

What happened before was that I added a few modules that were not present from the repository to the package and one of them was the simple lab entry module. I was getting ahead of myself in trying to customize the package even before installing it.

Thanks.

Kayode

1 Like