I've run into the same problem with Cobertura and Spring - what seemed to fix it was, in the context file, changing <aop:config> to <aop:config proxy-target-class="true">. I'm not entirely sure *why* that worked (I dealt with this a couple months ago, and it required a *lot* of googling to get any kind of idea of what to do, so I don't remember all the details), but that did the trick.
A. On Mon, Jul 6, 2009 at 6:26 AM, Chávez, Carlos <ccha...@agssa.net> wrote: > > We have found that SpringJUnit4ClassRunner is not compatible with the > > 4.5+ versions of JUnit. > > > > I think that you will find that in > > > > private UsuarioFacade usuarioFacade; > > > > that UsuarioFacade must be an interface in order for Spring to do it's > > magic. Is this the case? > > > > This does not explain why the problem only manifests itself during > > "mvn site", and not "mvn install" or "mvn test". > > > > Did it seem to work with JUnit 4.6 at all? If it did, then you unit > > tests were not executing because this combination cannot work. > > > > What version of Maven are you using? > > > > Cheers, > > > > Steve C > > > > Hi Steve. > > I'm using Apache Maven 2.2.0 (r788681; 2009-06-26 07:04:01-0600). > > Yes, I used too the junit 4.6 and for test or install goals works very > well, > for "site" plugin show the following exception: > > org.apache.maven.surefire.booter.SurefireExecutionException: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V; > nested exception is java.lang.NoSuchMethodError: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V > java.lang.NoSuchMethodError: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V > > that is why I switched to junit 4.4 version. > > > Now, i think i found was is causing the issue, I think it is the cobertura > maven plugin. My understanding is: The cobertura instruments the classes, > so > The cobertura tried to set a proxied object ($Proxy17) which of course is > not > of the type expected (UsuarioFacade), the error is: > > GRAVE: Caught exception while allowing TestExecutionListener > > [org.springframework.test.context.support.dependencyinjectiontestexecutionliste...@18eb7b8 > ] > to prepare test instance > [null(ni.gob.cgr.siirci.facade.UsuarioFacadeTestCase)] > org.springframework.beans.factory.BeanCreationException: Error creating > bean > with name 'ni.gob.cgr.siirci.facade.UsuarioFacadeTestCase': Injection of > resource methods failed; nested exception is > org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean > named > 'usuarioFacade' must be of type [ni.gob.cgr.siirci.facade.UsuarioFacade], > but > was actually of type [$Proxy17] > at > > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305) > at > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:998) > at > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329) > at > > org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110) > at > > org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) > at > > org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255) > at > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111) > at > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148) > at > > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61) > at > > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54) > at > org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) > at > org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) > at > org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52) > at > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97) > at > > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) > at > > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) > at > > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) > at org.apache.maven.surefire.Surefire.run(Surefire.java:177) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) > at > > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) > Caused by: > org.springframework.beans.factory.BeanNotOfRequiredTypeException: > Bean named 'usuarioFacade' must be of type > [ni.gob.cgr.siirci.facade.UsuarioFacade], but was actually of type > [$Proxy17] > at > > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) > at > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) > at > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) > at > > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435) > at > > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409) > at > > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537) > at > > org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:192) > at > > org.springframework.beans.factory.annotation.InjectionMetadata.injectMethods(InjectionMetadata.java:117) > at > > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:302) > ... 23 more > org.apache.maven.surefire.booter.SurefireExecutionException: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V; > nested exception is java.lang.NoSuchMethodError: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V > java.lang.NoSuchMethodError: > > org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V > at > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:155) > at > > org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61) > at > > org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54) > at > org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) > at > org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) > at > org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52) > at > > org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97) > at > > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) > at > > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) > at > > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) > at org.apache.maven.surefire.Surefire.run(Surefire.java:177) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) > at > > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) > > -- > Cheers. > Carlos Chávez. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >