spring - 为什么 aspect j 不能编织 show Xlint cantFindType

标签 spring tomcat aspectj

我已经写了一个 aspectj 类,我想通过像

这样的自动检测来编织

但是没有效果。 显示一些错误:

[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.RequestMap
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.SessionMap
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.util.AttributeMap
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.BooleanUtils
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type ognl.ASTChain
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type ognl.enhance.OrderedReturn
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.util.reflection.ReflectionContextState
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type ognl.Evaluation
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.mapper.ParameterAction
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.util.PrefixTrie$Node
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.mapper.DefaultActionMapper$2$1
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.mapper.DefaultActionMapper$2$2
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.mapper.DefaultActionMapper$2$3
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.dispatcher.mapper.DefaultActionMapper$2$4
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.RequestUtils
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.util.profiling.UtilTimerStack
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.DefaultActionInvocation
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.ActionEventListener
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.UnknownHandler
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.impl.StrutsActionProxy
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.DefaultActionProxy
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.StringEscapeUtils
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.CharSequenceTranslator
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.AggregateTranslator
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.StringEscapeUtils$CsvEscaper
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.StringEscapeUtils$CsvUnescaper
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.LookupTranslator
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.EntityArrays
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.ArrayUtils
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.UnicodeEscaper
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.CodePointTranslator
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.OctalUnescaper
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.UnicodeUnescaper
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.NumericEntityUnescaper
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.commons.lang3.text.translate.NumericEntityUnescaper$OPTION
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.ServletRequestAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.ServletResponseAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.ParameterAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.ApplicationAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.SessionAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.RequestAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.PrincipalAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.util.ServletContextAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.interceptor.MethodFilterInterceptorUtil
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.Preparable
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.interceptor.ScopedModelDriven
when weaving classes 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.ModelDriven
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.config.entities.Parameterizable
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.interceptor.ParameterNameAware
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type org.apache.struts2.interceptor.validation.SkipValidation
when weaving classes 
when weaving 
 [Xlint:cantFindType]
[TomcatInstrumentableClassLoader@14d659d] error can't determine annotations of missing type org.springframework.transaction.annotation.Transactional
when weaving type com.opensymphony.xwork2.util.AnnotationUtils
when weaving classes 
when weaving 
 [Xlint:cantFindType]

最佳答案

看来您正在尝试编织可能不应该编织的第 3 方类。

您可能应该将编织限制在 META-INF/aop.xml 中的包中像这样:

<?xml version="1.0"?>

<!--
    AspectJ load-time weaving config file with Spring aspects.
-->
<aspectj>


    <weaver options="-showWeaveInfo">
        <include within="com.yourpackage..*"/>
    </weaver>


    <aspects>
        <aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"/>
        <aspect name="org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect"/>
        <aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/>
        <aspect name="org.springframework.cache.aspectj.AnnotationCacheAspect"/>
    </aspects>

</aspectj>

在哪里<include within="com.yourpackage..*"/>是对您的包裹的限制。

关于spring - 为什么 aspect j 不能编织 show Xlint cantFindType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18851651/

相关文章:

java - Thymeleaf 应用不同的标题模式

java - 如何在 Spring 的过滤器中排除特定 URL?

java - 无法从 URL 位置 [classpath :spring/spring-persistence-layer. xml] 导入 bean 定义,即使该文件位于路径中

java - Tomcat 自动关闭

java - 使用 tomcat 进行本地开发,我是否必须以特殊方式设置我的 IDE?

java - 任意位置参数的切入点表达式

java - 如何在 war 包中配置 AspectJ 在 Weblogic 12c 中使用

java - 链接是否应该包含 HateOAS 中的身份验证 token ?

tomcat - 将带有 SAAJ 的 SOAPMessage 发送到 Tomcat 上的 servlet

java - 如何在 Guice 中定义 AOP 切入点