The White Rabbit

Dress for the job you want, not the job you have.

Published on Friday, 6 May 2022

Tags: spring-boot2 junit2 java3

[Solved] Failed to load ApplicationContext. BeanCreationException...

Error creating bean with name '...'. IllegalArgumentException: warning no match for this type name. [Java, Spring Boot, JUnit]


Problem

After solving this problem related to the execution of a Spring Boot application or any of the JUnit test cases in Eclipse, I got following kind of error messages:

java.lang.IllegalStateException: Failed to load ApplicationContext
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' defined in class path resource [org/springframework/data/web/config/ProjectingArgumentResolverRegistrar.class]: BeanPostProcessor before instantiation of bean failed;
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: ...
[Xlint:invalidAbsoluteTypeName]
...
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1141)
...
Caused by: java.lang.IllegalArgumentException: warning no match for this type name: ... [Xlint:invalidAbsoluteTypeName]

Solution

The problem of my application was the wrong path given in @AfterThrowing annotation to the pointcut parameter.

Wrong line: @AfterThrowing(pointcut="execution(* com.infy.service.ProjectAllocationServiceImpl.*(..))",throwing="exception")

After correction:

@AfterThrowing(pointcut="execution(* com.infy.infyinterns.service.ProjectAllocationServiceImpl.*(..))",throwing="exception")