wood burning stoves*
The moose likes Java in General and the fly likes JUnit and Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "JUnit and Spring" Watch "JUnit and Spring" New topic
Author

JUnit and Spring

Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
Hi there,

first of all I'm posting here because I cannot post on the Test section. When I enter on that section, I'm not logged in!!! Strange behaviour.

I'm trying to make an integration test with JUnit 4.4 and Spring 2.5.6 but when I run it, I get the exception:

java.lang.IllegalStateException: Failed to load ApplicationContext
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:201)
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
Caused by: java.lang.IllegalStateException: @WebServiceRef annotation is not supported on static fields
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$1.doWith(CommonAnnotationBeanPostProcessor.java:323)
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:523)
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:319)
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:277)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:745)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:448)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
java.security.AccessController.doPrivileged(Native Method)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:42)
org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:173)
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:197)

Does anyone know what's happening?

thanks in advance,
Manuel Leiria


Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Aditya Jha
Ranch Hand

Joined: Aug 25, 2003
Posts: 227

It's a very far shot not providing any code details and expecting people to come up with a solution to your problem.

Based upon the limited information, I might ask what do you get from this line?
Caused by: java.lang.IllegalStateException: @WebServiceRef annotation is not supported on static fields

 
wood burning stoves
 
subject: JUnit and Spring