Part 1:
org.springframework.beans.factory.BeanDefinitionSt oreException: Unexpected exception parsing XML document from class path resource [ApplicationContextAOP.xml]; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
Response to Part 1:
com.springsource.org.aopalliance-1.0.0 library
Part 2:
[org.springframework.aop.aspectj.AspectJMethodBefor eAdvice] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Cannot create inner bean '(inner bean)' of type [org.springframework.aop.aspectj.AspectJExpressionP ointcut] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '(inner bean)': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
Response to Part 2:
aspectweaver.jar
Were those correct libraries?
Part 3:
Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAd visor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdv isor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 49
execution(*com.idol.performers.Performer.perform(. .))
What is response to part 3?
The example is taken directly from Spring In Action 3rd , which was released few months ago... and book says that means taking any arguments...
I no longer understand whether I use AspectJ or Spring AOP... My head is collapsing.
MY XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<aop:config>
<aop:aspect ref="audience">
<!-- Before performance -->
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))" method="takeSeats"/>
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))" method="turnOffCellPhones" />
<!-- After performance -->
<aop:after-returning pointcut="execution(*com.idol.performers.Performer.perform(..))" method="applaud" />
<!-- After bad performance(exception thrown) -->
<aop:after-throwing pointcut="execution(*com.idol.performers.Performer.perform(..))" method="demandRefund" />
</aop:aspect>
</aop:config>
<bean id="audience" class="com.idol.Audience" />
<bean id="poeticDuke" class="com.performers.Juggler" />
</beans>
There is no quick guide on a single page to indicate at least which libraries it requires.
So I presume good part of us found that out of numerous exceptions, why it was difficult to add those to Spring library will be eternal mystery for me.(I guess there is some satanic part in developers to make people cry, I am in instance on the verge of vomiting, it happens when errors ironically never end)