- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当我尝试在 spring 中自动连接 aspectj 时出现以下错误
org.xml.sax.SAXParseException: The prefix "aop" for element "aop:aspectj-autoproxy" is not bound.
我的 appContext.xml 条目看起来像.....
<aop:aspectj-autoproxy/>
<bean id="helloFromAspectJ" class="com.cvs.esps.aspect.logging.TestAspect"/>
.....
关于如何消除此错误的一些帮助.. 不幸的是网站 http://forum.springsource.org被网络防火墙阻止.. 任何快速帮助将不胜感激。
这就是我添加行后得到的结果
<bean id="loggerProxy" class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator" />
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.bus.spring.BusApplicationListener' defined in class path resource [META-INF/cxf/cxf.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Cannot create inner bean 'cxf:logging#d306dd' of type [org.apache.cxf.feature.LoggingFeature] while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf:logging#d306dd': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut doPostGetPatientDataJSON
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:308)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:948)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:702)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Cannot create inner bean 'cxf:logging#d306dd' of type [org.apache.cxf.feature.LoggingFeature] while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf:logging#d306dd': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut doPostGetPatientDataJSON
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:117)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.apache.cxf.bus.spring.BusExtensionPostProcessor.getBus(BusExtensionPostProcessor.java:62)
at org.apache.cxf.bus.spring.BusExtensionPostProcessor.postProcessBeforeInitialization(BusExtensionPostProcessor.java:53)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
... 30 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf:logging#d306dd': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut doPostGetPatientDataJSON
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219)
... 50 more
Caused by: java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut doPostGetPatientDataJSON
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:302)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:189)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:176)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:157)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:187)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:244)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:278)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:86)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:69)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:296)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1343)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
... 54 more
最佳答案
您的代码中是否有命名空间声明?像这样:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
...>
关于java - Spring 的Aspectj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1304289/
我的问题与 Spring 的 AspectJ 模式有关,特别是如何启用它: 交易管理 缓存 1)我注意到,为了启用 AspectJ 模式进行事务管理,我只需执行以下操作: @Configuration
当我尝试使用 Java 17 运行 AspectJ 检测时,我总是会遇到如下错误: java.lang.reflect.InvocationTargetException at jav
我有一个应该记录的跟踪方面: 进入 退出(返回类型为 void) 返回[返回对象] 抛出[异常消息] 我对第二个有问题。我如何在不重复记录所有退出的情况下为这种情况创建建议,就像现在我有一个 @Aft
我已经使用 @Aspect 注释声明了我的切面,但建议似乎没有得到应用。该方面适用于我拥有的其他一些项目,主要区别似乎是其他项目完全使用注释连接,并且这个特定项目是 xml 连接的。唯一连接注释的 b
我正在尝试使用加载时编织将 perf4j 绑定(bind)到程序中,但它似乎在我的类路径中找不到 aop.xml。要么是这样,要么它没有编织这个方面,因为它没有找到它。我已启用 aop.xml 的详细
我是 spring 框架的新手,正在尝试一些示例来理解 AOP,这是我到目前为止所做的,但它不起作用。 问题是我一添加 对于 spring.xml,我的构建失败说无法创建具有空指针异常的 bean。但
我尝试使用 AspectJ 围绕 Kotlin 函数编织方面,但没有成功。也许我只是配置不正确,或者 AspectJ 不支持这个。 有谁知道这是否可以使用例如 maven 和 Eclipse(或 In
我正在使用 Eclipse 4 和 AspectJ 的最新版本进行开发。我正在用修改后的库(二进制编织)替换 Java 6 库。问题是当前正在编织的代码是 Java 7 代码,而我需要它是 Java
我正在将我的项目从 java 7 迁移到 java 8,我遇到的问题与使用 aspectj-maven-plugin 的 aspectj 编织有关。 我可以根据 Haus documentation
嘿,我想将 AOP 添加到我的 Web 项目中。我下载了 eclipse 3.4.1 的 ajdt2.0.1。但是当我将此项目转换为 AspectJ 项目时,出现了很多不应该发生的编译错误。比如“XX
我最近在我的 Windows 7 机器上从 eclipse Juno 升级到 Luna,我的 aspectj 编译出现问题。我收到此错误: [ERROR] Failed to execute goal
我想创建一个注释,它使用环绕方面来使用该注释清理参数。 例如,一个方法可能如下所示: public void setName(@Scrubbed String name) { ... } 也许 pub
我无法理解aspectJ的编译时和加载时编织,也无法弄清楚使用什么(以及如何使用ajc)来编译和构建我的项目。 这是我的项目结构:- TestProject:一个java服务库。这正被其他一些人使
我想拦截给定类的任何子类的非注释方法的执行。 例如,假设我有类 Base: public class Base { public void baseMethod() { //shouldn't
我正在尝试使用 AspectJ 和运行时编织。我创建了一个方面 @Aspect(value = "TraceAspect") public class TraceAspect { @Arou
我只是像下面描述的那样实现了AspectJ:https://stackoverflow.com/a/10998044/2182503 此解决方案工作正常,直到我注意到@Autowired中的@Init
我正在使用 AspectJ 来建议所有具有所选类参数的公共(public)方法。我尝试了以下方法: pointcut permissionCheckMethods(Session sess) :
我正在尝试创建一个 AspectJ Aspect 来拦截具有通用接口(interface)的返回方法。 这是我的 AspectJ @AspectJ public class MyAspect {
使用 Aspect annotation 创建方面时如所述 here ,是否可以将此注释与包含状态的类一起使用(例如,一旦命中切入点,成员变量就会发生变化)?或者换句话说:方面类是单例吗?注释的源代码
当我尝试使用 Roo 创建的 JPA 对象时出现此错误。 Entity manager has not been injected (is the Spring Aspects JAR configu
我是一名优秀的程序员,十分优秀!