Saturday, November 30, 2013

Error in Spring Aop
































































































































































































































































Hi































































































































































































































































Am beginner for Spring framework. Now am leaning Spring AOP. When I use this below mentioned code































































































































































































































































am getting error like this,
































































































































































































































































Nov 30, 2013 5:24:18 PM org.springframework.context.support.ClassPathXmlAp plicationContext prepareRefresh































































































































































































































































INFO: Refreshing org.springframework.context.support.ClassPathXmlAp plicationContext@988707: startup date [Sat Nov 30 17:24:17 IST 2013]; root of context hierarchy































































































































































































































































Nov 30, 2013 5:24:18 PM org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions































































































































































































































































INFO: Loading XML bean definitions from class path resource [aspectFile.xml]































































































































































































































































Nov 30, 2013 5:24:18 PM org.springframework.beans.factory.support.DefaultL istableBeanFactory destroySingletons































































































































































































































































INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@b99d08: defining beans [org.springframework.aop.config.internalAutoProxyCr eator,trianle,AspectClass]; root of factory hierarchy































































































































































































































































Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyC reator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.Annotat ionAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice































































































































































































































































at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:1007)































































































































































































































































at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBeanInstance(Abst ractAutowireCapableBeanFactory.java:953)































































































































































































































































at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:487)































































































































































































































































at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:458)































































































































































































































































at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 95)































































































































































































































































at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:223)































































































































































































































































at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:292 )































































































































































































































































at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:198)































































































































































































































































at org.springframework.context.support.AbstractApplic ationContext.registerBeanPostProcessors(AbstractAp plicationContext.java:741)































































































































































































































































at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:464)































































































































































































































































at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)































































































































































































































































at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)































































































































































































































































at org.sasi.springwork.aspect.AsspectApplication.main (AsspectApplication.java:10)































































































































































































































































Caused by: org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.aop.aspectj.annotation.Annotat ionAwareAspectJAutoProxyCreator]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice































































































































































































































































at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:163)































































































































































































































































at org.springframework.beans.factory.support.SimpleIn stantiationStrategy.instantiate(SimpleInstantiatio nStrategy.java:87)































































































































































































































































at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.instantiateBean(Abstrac tAutowireCapableBeanFactory.java:1000)































































































































































































































































... 12 more































































































































































































































































Caused by: java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice































































































































































































































































at java.lang.ClassLoader.defineClass1(Native Method)































































































































































































































































at java.lang.ClassLoader.defineClass(Unknown Source)































































































































































































































































at java.security.SecureClassLoader.defineClass(Unknow n Source)































































































































































































































































at java.net.URLClassLoader.defineClass(Unknown Source)































































































































































































































































at java.net.URLClassLoader.access$100(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.security.AccessController.doPrivileged(Native Method)































































































































































































































































at java.net.URLClassLoader.findClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.defineClass1(Native Method)































































































































































































































































at java.lang.ClassLoader.defineClass(Unknown Source)































































































































































































































































at java.security.SecureClassLoader.defineClass(Unknow n Source)































































































































































































































































at java.net.URLClassLoader.defineClass(Unknown Source)































































































































































































































































at java.net.URLClassLoader.access$100(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.security.AccessController.doPrivileged(Native Method)































































































































































































































































at java.net.URLClassLoader.findClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.defineClass1(Native Method)































































































































































































































































at java.lang.ClassLoader.defineClass(Unknown Source)































































































































































































































































at java.security.SecureClassLoader.defineClass(Unknow n Source)































































































































































































































































at java.net.URLClassLoader.defineClass(Unknown Source)































































































































































































































































at java.net.URLClassLoader.access$100(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.security.AccessController.doPrivileged(Native Method)































































































































































































































































at java.net.URLClassLoader.findClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at org.springframework.aop.aspectj.annotation.Annotat ionAwareAspectJAutoProxyCreator.<init>(AnnotationA wareAspectJAutoProxyCreator.java:53)































































































































































































































































at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)































































































































































































































































at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)































































































































































































































































at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)































































































































































































































































at java.lang.reflect.Constructor.newInstance(Unknown Source)































































































































































































































































at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:148)































































































































































































































































... 14 more































































































































































































































































Caused by: java.lang.ClassNotFoundException: org.aopalliance.aop.Advice































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.net.URLClassLoader$1.run(Unknown Source)































































































































































































































































at java.security.AccessController.doPrivileged(Native Method)































































































































































































































































at java.net.URLClassLoader.findClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)































































































































































































































































at java.lang.ClassLoader.loadClass(Unknown Source)































































































































































































































































... 56 more
































































































































































































































































my code:































































































































































































































































aspectFile.xml































































































































































































































































<?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/schem...-beans-3.0.xsd































































































































































































































































Index of /schema/context































































































































































































































































http://www.springframework.org/schem...ontext-3.0.xsd































































































































































































































































Index of /schema/aop































































































































































































































































http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
































































































































































































































































<aop:aspectj-autoproxy/>
































































































































































































































































<bean id="triangle" class="org.sasi.springwork.aspect.Triangle">































































































































































































































































<property name="name" value="AOP "/>































































































































































































































































</bean>
































































































































































































































































<bean name="AspectClass" class="org.sasi.springwork.aspect.AspectClass"/>































































































































































































































































</beans>
































































































































































































































































package org.sasi.springwork.aspect;
































































































































































































































































import org.aspectj.lang.annotation.Aspect;































































































































































































































































import org.aspectj.lang.annotation.Before;
































































































































































































































































@Aspect































































































































































































































































public class AspectClass {
































































































































































































































































@Before("execution(public String getName())")































































































































































































































































public void login(){































































































































































































































































System.out.println("Safe to run");































































































































































































































































}
































































































































































































































































Some one please help me..
































































































































































































































































Thanks in advance































































































































































































































































































































































































































































































































No comments:

Post a Comment