Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-12787

Unit Test Failure ObjectPropertyUtilsTest fails locally with ClassNotFoundException TestAttributeQueryServiceImpl

    Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-12876Investigate intermittent unit test failures on 2.5
      KULRICE-3747Unit Test Failures in 1.0.1.1
      KULRICE-7399fix unit test failures
      KULRICE-9939ComponentUtilsTest unit test failures
      KULRICE-7311Fix failing tests in build
      KULRICE-1433Fix the unit tests so they can be run locally
      KULRICE-13327IT Failure PostProcessorTest in CI, passes locally
      KULRICE-10415ViewIndexTest.testClearIndexesAfterRender unit test failure
      KULRICE-9908ComponentUtilsTest.initializationError unit test failures
      KULRICE-1355KNS Unit Tests don't all run successfully locally when run as a group
    • Sprint:
      Core 2.5.0-m4 Sprint 1
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required

      Description

      
      
      org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.kuali.rice.krad.demo.uif.library.TestAttributeQueryServiceImpl] for bean with name 'testAttributeQueryService' defined in ServletContext resource [/ObjectPropertyUtilsTest-test-context.xml]; nested exception is java.lang.ClassNotFoundException: org.kuali.rice.krad.demo.uif.library.TestAttributeQueryServiceImpl
      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1275)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1344)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:910)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
      	at org.kuali.rice.core.framework.resourceloader.SpringResourceLoader.start(SpringResourceLoader.java:86)
      	at org.kuali.rice.core.api.resourceloader.ResourceLoaderContainer.start(ResourceLoaderContainer.java:52)
      	at org.kuali.rice.core.api.resourceloader.GlobalResourceLoader.start(GlobalResourceLoader.java:76)
      	at org.kuali.rice.krad.uif.util.UifUnitTestUtils.establishMockConfig(UifUnitTestUtils.java:186)
      	at org.kuali.rice.krad.uif.util.ObjectPropertyUtilsTest.setup(ObjectPropertyUtilsTest.java:86)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      Caused by: java.lang.ClassNotFoundException: org.kuali.rice.krad.demo.uif.library.TestAttributeQueryServiceImpl
      	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:423)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      	at org.springframework.util.ClassUtils.forName(ClassUtils.java:260)
      	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:416)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1296)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1267)
      	... 30 more
      
      
      

        Issue Links

          Activity

          Hide
          Shannon Hess added a comment -

          Hi Mark,

          I having some trouble determining the cause of this problem and how to fix the issue and I was wondering if you could take a look. If I remove the following beans from ObjectPropertyUtilsTest-test-context.xml then I get the error below.

          Beans I removed to get the test running:

          <bean id="testAttributeQueryService" class="org.kuali.rice.krad.demo.uif.library.TestAttributeQueryServiceImpl" />
          
          <bean id="viewService" class="org.kuali.rice.krad.uif.util.TestViewService">
          	<property name="dataDictionary" ref="dataDictionary" />
          </bean>
          

          One of the Errors:

          Error running test testSetBoolean
          java.lang.IllegalArgumentException: Error setting property 'booleanProp' on org.kuali.rice.krad.uif.util.ObjectPropertyUtilsTest$TestBean@62b970cc with true
          ...
          ...
          Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'booleanEditor' is defined
          

          This is true not only for ObjectPropertyUtilsTest. All of the tests that have a corresponding *-test-context.xml file are having similar issues. As far I can tell from looking at runs on https://ci.kuali.org/job/rice-2.5-test-unit/ , these test have been ignored as far back as the tests go - from at least May 6th so I'm having trouble determine what change caused the issue. DataDictionary.setModuleDictionaryFiles is called with the list of XML files from uifDictionaryBeans and PropertyEditors.xml is one of the files in the list, but it doesn't appear to be loaded.

          If you could look at the test to see if there is something obvious I'm missing that would be great.

          Thanks,
          Shannon

          Show
          Shannon Hess added a comment - Hi Mark, I having some trouble determining the cause of this problem and how to fix the issue and I was wondering if you could take a look. If I remove the following beans from ObjectPropertyUtilsTest-test-context.xml then I get the error below. Beans I removed to get the test running: <bean id= "testAttributeQueryService" class= "org.kuali.rice.krad.demo.uif.library.TestAttributeQueryServiceImpl" /> <bean id= "viewService" class= "org.kuali.rice.krad.uif.util.TestViewService" > <property name= "dataDictionary" ref= "dataDictionary" /> </bean> One of the Errors: Error running test testSetBoolean java.lang.IllegalArgumentException: Error setting property 'booleanProp' on org.kuali.rice.krad.uif.util.ObjectPropertyUtilsTest$TestBean@62b970cc with true ... ... Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'booleanEditor' is defined This is true not only for ObjectPropertyUtilsTest. All of the tests that have a corresponding *-test-context.xml file are having similar issues. As far I can tell from looking at runs on https://ci.kuali.org/job/rice-2.5-test-unit/ , these test have been ignored as far back as the tests go - from at least May 6th so I'm having trouble determine what change caused the issue. DataDictionary.setModuleDictionaryFiles is called with the list of XML files from uifDictionaryBeans and PropertyEditors.xml is one of the files in the list, but it doesn't appear to be loaded. If you could look at the test to see if there is something obvious I'm missing that would be great. Thanks, Shannon
          Hide
          Mark Fyffe (Inactive) added a comment -

          Are the tests failing from Maven, or are you running in an IDE?

          The reason for this failure is that TestAttributeQueryServiceImpl is a class in rice-krad-sampleapp-web, which depends on rice-krad-web-framework. Since a circular dependency is not allowed, we have set a JUnit assumption to ignore tests that require downstream resources until they become available. In CI, we first run 'mvn install -DskipTests', then run 'mvn package' to complete the tests.

          If you are running in IntelliJ, can you first run the Maven test (or later) phase on rice-krad-web-framework then try again?

          FWIW - At the 'process-test-resources' phase, rice-krad-web-framework unpacks resources from the following downstream artifacts in order to support basic data dictionary functionality for testing code reliant on specific datadictionary components defined by XML.

          • rice-krad-web
          • rice-kns
          • rice-impl
          • rice-kim-impl
          • rice-krad-sampleapp-impl
          • rice-krad-sampleapp-web

          There has been a good deal of discussion on whether or not this is a good practice, primarily due to the confusion outlined in this issue Some of this is captured in KULRICE-11491.

          Show
          Mark Fyffe (Inactive) added a comment - Are the tests failing from Maven, or are you running in an IDE? The reason for this failure is that TestAttributeQueryServiceImpl is a class in rice-krad-sampleapp-web, which depends on rice-krad-web-framework. Since a circular dependency is not allowed, we have set a JUnit assumption to ignore tests that require downstream resources until they become available. In CI, we first run 'mvn install -DskipTests', then run 'mvn package' to complete the tests. If you are running in IntelliJ, can you first run the Maven test (or later) phase on rice-krad-web-framework then try again? FWIW - At the 'process-test-resources' phase, rice-krad-web-framework unpacks resources from the following downstream artifacts in order to support basic data dictionary functionality for testing code reliant on specific datadictionary components defined by XML. rice-krad-web rice-kns rice-impl rice-kim-impl rice-krad-sampleapp-impl rice-krad-sampleapp-web There has been a good deal of discussion on whether or not this is a good practice, primarily due to the confusion outlined in this issue Some of this is captured in KULRICE-11491 .
          Hide
          Shannon Hess added a comment -

          Mark,

          Thanks for the help, I didn't have a good understanding of how that was all working. I ran the test phase on rice-krad-web-framework, but I was still getting the same error even when the test phase itself ran. I dug around and found that an exclude had been added to krad-unpack-helper for KULRICE-12246 on 5/6/2014 so none of the classes were unpacked. When I revert that change it got past the error and ObjectPropertyUtilsTest runs successfully. However, one test that used be ignored is now failing (InitializeDataFieldFromDictionaryTest) and one test that was passing before is now failing (StaticWeavingTest) so I'm trying to determine the best way to fix all of the issues.

          Exclude that was added:

          <target name="krad-unpack-helper" if="krad.unpack.exists.${krad.unpack.artifact}">
            <unzip src="${krad.unpack.path}" dest="${krad.unpack.out}">
              <patternset>
          	<exclude name="**/*.class"/>
              </patternset>
            </unzip>
          </target>
          

          Thanks again,
          Shannon

          Show
          Shannon Hess added a comment - Mark, Thanks for the help, I didn't have a good understanding of how that was all working. I ran the test phase on rice-krad-web-framework, but I was still getting the same error even when the test phase itself ran. I dug around and found that an exclude had been added to krad-unpack-helper for KULRICE-12246 on 5/6/2014 so none of the classes were unpacked. When I revert that change it got past the error and ObjectPropertyUtilsTest runs successfully. However, one test that used be ignored is now failing (InitializeDataFieldFromDictionaryTest) and one test that was passing before is now failing (StaticWeavingTest) so I'm trying to determine the best way to fix all of the issues. Exclude that was added: <target name= "krad-unpack-helper" if = "krad.unpack.exists.${krad.unpack.artifact}" > <unzip src= "${krad.unpack.path}" dest= "${krad.unpack.out}" > <patternset> <exclude name= "**/*.class" /> </patternset> </unzip> </target> Thanks again, Shannon
          Hide
          Shannon Hess added a comment -

          Instead of un-packing all classes, I unpacked only the classes needed for the tests to run.

          After doing that, the StaticWeavingTest issue went away but the issue with InitializeDataFieldFromDictionaryTest persisted. I fixed that issue by bringing in the changes made on the 2.4 branch for TestView.xml. It was changed on the 2.4 branch on 5/19/2014 for KULRICE-12625, and the change was never merged when the other 2.4 changes were merged. Bringing that change in fixed the InitializeDataFieldFromDictionaryTest. However, that caused ObjectPropertyUtilsTest.testCustomEditor() and ViewLifecycleTest.testPerformanceMediumAll() to fail.

          So that this issue can be closed, I'm going to ignore those tests for now and create JIRAs to fix each of those tests.

          Show
          Shannon Hess added a comment - Instead of un-packing all classes, I unpacked only the classes needed for the tests to run. After doing that, the StaticWeavingTest issue went away but the issue with InitializeDataFieldFromDictionaryTest persisted. I fixed that issue by bringing in the changes made on the 2.4 branch for TestView.xml. It was changed on the 2.4 branch on 5/19/2014 for KULRICE-12625 , and the change was never merged when the other 2.4 changes were merged. Bringing that change in fixed the InitializeDataFieldFromDictionaryTest. However, that caused ObjectPropertyUtilsTest.testCustomEditor() and ViewLifecycleTest.testPerformanceMediumAll() to fail. So that this issue can be closed, I'm going to ignore those tests for now and create JIRAs to fix each of those tests.
          Hide
          Shannon Hess added a comment -

          The following issues have been created for the two remaining test failures:

          KULRICE-12830 - ObjectPropertyUtilsTest.testCustomEditor() is failing - Class to retrieve property from was null
          KULRICE-12831 - ViewLifecycleTest.testPerformanceMediumAll failing occasionally with ArrayIndexOutOfBoundsException

          IMPORTANT NOTE - In order for the tests in ObjectPropertyUtilsTest & ViewLifecycleTest to NOT be ignored, certain classes from rice-krad-sampleapp-web must be unpacked via krad-unpack-testresources (found in testresources-build.xml). To do this in IntelliJ first run the Maven test phase on rice-krad-web-framework (view--> tool windows --> Maven Projects). Then the ObjectPropertyUtilsTest & ViewLifecycleTest can be debugged, etc

          Show
          Shannon Hess added a comment - The following issues have been created for the two remaining test failures: KULRICE-12830 - ObjectPropertyUtilsTest.testCustomEditor() is failing - Class to retrieve property from was null KULRICE-12831 - ViewLifecycleTest.testPerformanceMediumAll failing occasionally with ArrayIndexOutOfBoundsException IMPORTANT NOTE - In order for the tests in ObjectPropertyUtilsTest & ViewLifecycleTest to NOT be ignored, certain classes from rice-krad-sampleapp-web must be unpacked via krad-unpack-testresources (found in testresources-build.xml). To do this in IntelliJ first run the Maven test phase on rice-krad-web-framework (view--> tool windows --> Maven Projects). Then the ObjectPropertyUtilsTest & ViewLifecycleTest can be debugged, etc

            People

            • Assignee:
              Shannon Hess
              Reporter:
              Erik Meade
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4 hours Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 3 hours
                1d 3h

                  Agile

                    Structure Helper Panel