1

When trying to load the application context from the SpringJunit4ClassRunner for unit test cases throwing exception.

java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailingThreadService' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException Caused by: java.lang.IllegalArgumentException

The code is as follows

public class XXXXThreadServiceImpl extends BaseXXXXServiceImpl
    implements XXXXThreadService, Runnable {

    public void initialize() {
    }
}

In application context file for spring is as follows

<bean id="mailingThreadService" class="com.xd.mailinglist.services.impl.MailingThreadServiceImpl"
        init-method="initialize" destroy-method="shutdown" scope = "singleton">
    <property name="serviceAgent" ref="cassNcoaServiceAgent"/>
    <property name="dao" ref="addressDataService"/> 
</bean>

The unit test goes here

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( {"/applicationContext.xml"})
public class SomeServiceImplTest {
}

When we install using maven its throwing the following error:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailingThreadService' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException

f_puras
  • 2,521
  • 4
  • 33
  • 38
  • 1
    Post here your console with stack trace. – Clement Amarnath May 10 '16 at 07:36
  • Possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors) – Raedwald May 10 '16 at 08:25

0 Answers0