Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4364 Upgrade to Hibernate 4
  3. TRUNK-4704

Serialization.xstream module must be fixed to work with Hibernate 4

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Must
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Platform 2.0.0
    • Component/s: None
    • Complexity:
      Medium

      Description

      SerializedObjectDAOTest in openmrs-core fails with

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serializationServiceTarget$child#0' defined in URL [jar:file:/C:/Users/Rafal/AppData/Local/Temp/1430828752481.openmrs-lib-cache/serialization.xstream/serialization.xstream.jar!/moduleApplicationContext.xml]: Cannot resolve reference to bean 'xstreamSerializer' while setting bean property 'serializers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xstreamSerializer' defined in URL [jar:file:/C:/Users/Rafal/AppData/Local/Temp/1430828752481.openmrs-lib-cache/serialization.xstream/serialization.xstream.jar!/moduleApplicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openmrs.module.serialization.xstream.XStreamSerializer]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/collection/PersistentList
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:382)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
      	at org.openmrs.test.StartModuleExecutionListener.prepareTestInstance(StartModuleExecutionListener.java:102)
      	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:200)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:252)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:254)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xstreamSerializer' defined in URL [jar:file:/C:/Users/Rafal/AppData/Local/Temp/1430828752481.openmrs-lib-cache/serialization.xstream/serialization.xstream.jar!/moduleApplicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openmrs.module.serialization.xstream.XStreamSerializer]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/collection/PersistentList
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1093)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1038)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
      	... 38 more
      Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openmrs.module.serialization.xstream.XStreamSerializer]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/collection/PersistentList
      	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
      	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1086)
      	... 46 more
      Caused by: java.lang.NoClassDefFoundError: org/hibernate/collection/PersistentList
      	at org.openmrs.module.serialization.xstream.mapper.HibernateCollectionMapper.<clinit>(HibernateCollectionMapper.java:27)
      	at org.openmrs.module.serialization.xstream.XStreamSerializer$1.wrapMapper(XStreamSerializer.java:95)
      	at com.thoughtworks.xstream.XStream.buildMapper(XStream.java:491)
      	at com.thoughtworks.xstream.XStream.<init>(XStream.java:451)
      	at com.thoughtworks.xstream.XStream.<init>(XStream.java:381)
      	at com.thoughtworks.xstream.XStream.<init>(XStream.java:356)
      	at org.openmrs.module.serialization.xstream.XStreamSerializer$1.<init>(XStreamSerializer.java:91)
      	at org.openmrs.module.serialization.xstream.XStreamSerializer.<init>(XStreamSerializer.java:91)
      	at org.openmrs.module.serialization.xstream.XStreamSerializer.<init>(XStreamSerializer.java:75)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
      	... 48 more
      Caused by: java.lang.ClassNotFoundException: org.hibernate.collection.PersistentList
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:492)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	... 62 more
      

      Please create a dedicated issue in serialization.xstream module and link it to this issue.

      After the module is fixed, the test must be unignored and updated to use the latest omod.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                Unassigned
                Reporter:
                raff Rafal Korytkowski
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h