java.lang.IllegalStateException: Failed to load ApplicationContext

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

Expert tip

If you're unit testing, you should instantiate only the service and mock the dependencies. If you're testing integration, you should add all the mocking to the configurations file.

Solutions on the web

via GitHub by wzl1990
, 7 months ago
Failed to load ApplicationContext
via GitHub by ossrjus
, 1 year ago
via Stack Overflow by Tyler Whalen
, 1 year ago
via Spring JIRA by Hendy Irawan, 1 year ago
Failed to load ApplicationContext
via Stack Overflow by Avinash G A
, 1 year ago
Failed to load ApplicationContext
java.lang.IllegalArgumentException: Cannot load an ApplicationContext with a NULL 'contextLoader'. Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(
at org.springframework.boot.test.autoconfigure.AutoConfigureReportTestExecutionListener.prepareTestInstance(
at org.springframework.test.context.TestContextManager.prepareTestInstance(
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(
at org.junit.runners.ParentRunner$
at org.junit.runners.ParentRunner$1.schedule(
at org.junit.runners.ParentRunner.runChildren(
at org.junit.runners.ParentRunner.access$000(
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(

Users with the same issue

27 times, 1 week ago
40 times, 1 week ago
Once, 1 week ago
6 times, 3 weeks ago
Once, 3 weeks ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.