java.lang.IllegalArgumentException: warning no match for this type name: ru.sbt.filial.cards.aspect.SomeBean [Xlint:invalidAbsoluteTypeName]
java.lang.illegalargumentexception: error at ::0 formal unbound in pointcut
can 't determine implemented interfaces of missing type
pointcuts java
spring aop within
pointcut in spring
spring boot pointcut example
the pointcut expression
I never used Spring AOP and trying to configure my first bean. It seems that I configured it properly, but I get an exception that the bean is not found.
My aspect is –
@Aspect @Component public class IdentificationAspect { @Before("execution(* ru.sbt.filial.cards.aspect.SomeBean.*(..))") public void logBefore(JoinPoint joinPoint) throws Throwable { System.out.println("logBefore() is running!"); System.out.println("hijacked : " + joinPoint.getSignature().getName()); System.out.println("******"); } }
And my bean that AOP doesn't find is -
package ru.sbt.filial.cards.aspect; import org.springframework.stereotype.Component; @Component public class SomeBean { public void printSmth() { System.out.println("!!!!!!!!!!!"); } }
I've got the following exception -
Caused by: java.lang.IllegalArgumentException: warning no match for this type name: ru.sbt.filial.cards.aspect.SomeBean [Xlint:invalidAbsoluteTypeName] at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301) at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:207) at org.springframework.aop.aspectj.AspectJExpressionPointcut.getFallbackPointcutExpression(AspectJExpressionPointcut.java:358) at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:255) at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:208) at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:262) at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:294) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87) at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:356) at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:319) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:412) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1629) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) ... 165 more
I have following maven dependencies -
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>3.2.0.RELEASE</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.7.3</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.7.3</version> </dependency>
And my spring applicationContext.xml configuration is -
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <mvc:annotation-driven/> <aop:aspectj-autoproxy/> <bean id="someBean" class="ru.sbt.filial.cards.aspect.SomeBean"> </bean>
UPDATE I added to my Spring configuration line
<context:component-scan base-package="ru.sbt.filial.cards.aspect"/>
but still same message. I also tried to annotate different ways - if I don't specify the bean i.e. write -
@Before("execution(* ru.sbt.filial.cards.aspect.*.*(..))")
instead
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean.*(..))")
I have no error on loading, but aop method is not invoked.
I also tried to annotate like this
@Before("this(ru.sbt.filial.cards.aspect.SomeBean) and execution(* printSmth(..))")
but with same result - no match for this type name. Any more ideas??
I have the same problem as you and I've solved mine. I give you two suggestions, you can try it out. Please modify the @Before annotation in the aspect class as one of the following:
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean.logBefore(..))")
or
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean..*(..))")
Hope it helps.
AspectJExpressionPointcut.buildPointcutExpression() has thrown an , name, i.e. the pointcut should be @Pointcut("execution(* dao.UserDaoImpl.mySave())"). That is what [Xlint:invalidAbsoluteTypeName] implies in the first place. What is the difference between canonical name, simple name and class name in Java Class? 12 java.lang.IllegalArgumentException: warning no match for this type name: ru.sbt.filial.cards.aspect.SomeBean [Xlint:invalidAbsoluteTypeName]
To run successfully, In your spring applicationContext.xml configuration file add
<context:component-scan base-package="ru.sbt.filial.cards.aspect"/>
As you used @Component
annotation in SomeBean class
Update:
try by adding method name to @Before:
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean.logBefore(..))")
aws/aws-xray-sdk-java, SomeBean [Xlint:invalidAbsoluteTypeName] Spring AOP expression throw java.lang. IllegalArgumentException: warning no match for this type name: s name 'triangle' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is java.lang. Controller [Xlint:invalidAbsoluteTypeName], 3. java.lang.IllegalArgumentException: warning no match for this type name: org.springframework.batch.item.ItemReader [Xlint:invalidAbsoluteTypeName] My guess is that, since ItemReader is a generic interface, the pointcut is not matching properly.
you lose the class.
@Before("execution(* ru.sbt.filial.cards.aspect.**SomeBean.***(..))")
In your way, "somebean" is a package, the * after it is a method, and you should put classes between them. You can do it like
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean.* .*(..))")
or
@Before("execution(* ru.sbt.filial.cards.aspect.SomeBean..*(..))")
Xlint:invalidAbsoluteTypeName, java.lang.IllegalArgumentException: warning no match for this type name: ru.sbt.filial.cards.aspect.SomeBean [Xlint:invalidAbsoluteTypeName]. I never used java.lang.IllegalArgumentException: warning no match for this type name: org.tempuri.EntradaSoap [Xlint:invalidAbsoluteTypeName] Note: org.tempuri.EntradaSoap was the web service interface which had the method that I was trying to add to the cache. This problem was related with Spring AOP configuration, like my pointcut was wrong.
java.lang.IllegalArgumentException: не папярэдзіўшы ні аднаго , AbstractXRayInterceptor class, Project is not usable for non spring-data-jpa application java.lang.IllegalArgumentException: warning no match for this type name: org.springframework.data.repository.Repository [Xlint:invalidAbsoluteTypeName] Component; @Aspect @Component public class XRayInterceptor extends Getting: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: warning no match for this type name: com.mypackage [Xlint:invalidAbsoluteTypeName] #2 sebDK opened this issue Jul 1, 2015 · 0 comments
ru.sbt.filial.cards.aspect.SomeBean [Xlint: invalidAbsoluteTypeName], java.lang.IllegalArgumentException: warning no match for this type name: ru.sbt.filial.cards.aspect.SomeBean [Xlint:invalidAbsoluteTypeName] springjava.lang warning no match for this type name. Caused by: java.lang.IllegalArgumentException: warning no match for this type name: MyService [Xlint:invalidAbsoluteTypeName]
Questions for overwrite, Initialization of bean failed; nested exception is > java.lang.IllegalArgumentException: warning no match for this type > name: warning no match for this type name Xlint:invalidAbsoluteTypeName Mar 20th, 2007, 07:00 AM hi, i am trying to use aop for definition of bean. But i always get an exception "warning no match for this type name: eu.tra de.eutn2.backend.bean.business [Xlint:invalidAbsoluteTypeName]"
Comments
- you missed to add bean IdentificationAspect in configuration file
- For me, changing from ".*" to "..*" solved the problem I had when deploying in JBoss 7. But can you explain why "..*" is needed? (".*" worked just fine in my standalone unit tests)
- @caprica I guess the first '.' is a dot itself but the second '.' is a wildcard matching any character and '*' means matching any number. So
SomeBean..*(..)
means matching all methods ofSomeBean
likeSomeBean.methodA(..)
orSomeBean.methodB(..)
. - I added, but still same message. I also tried to annotate different ways - if I don't specify the bean name -