Spring aop 的命名空间问题

Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.springframework.org/schema/aop]
网上大多数是说少了jar包,但是把jar包加上去也没有用啊

3个回答

用maven管理试试,

提示的就是配置问题

dcxy0
Q544471255 回复wanpengcheng199311: maven可不是自动下载jar包这么简单,maven是管理依赖关系,比如你的A包需要依赖B包,你自己手动下载你可能不知道,但是maven就会自动去下载依赖的包
一年多之前 回复
wanpengcheng199311
wanpengcheng199311 maven管理是自动下载jar包,但是我这个手动下载的jar放在lib下面,应该也没有啥问题啊
一年多之前 回复

配置问题:无法找到NamespaceHandler名称空间,是不是你的xml配置路径写错了啊,导致不能正确找到

wanpengcheng199311
wanpengcheng199311 xml里面的配置都应该没有错
一年多之前 回复
wanpengcheng199311
wanpengcheng199311 xml文件我是放在src目录下的,
一年多之前 回复

你去找一个官方的xml文件头复制一下吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Spring中基于aop命名空间的AOP
Spring中基于aop命名空间的AOP 一(一点准备工作和一个例子) (残梦追月原创,转载请注明) 本文地址:http://www.blogjava.net/cmzy/archive/2008/08/23/223870.html     在某些时候,我们工程中使用的JDK 不一定就是1.5 以上,也就是说可能不支持Annotation 注解,这时自然也就不能使用@AspectJ 注解驱...
Spring aop Spring aop
Spring aop Spring aop
spring aop spring aop
spring aop spring aop spring aop spring aop spring aop spring aop spring aop spring aop spring aop
基于tx/aop命名空间的spring声明式事务管理
我们知道,spring声明式事务管理有两种方式:1、使用tx/aop命名空间XML配置文件式的方式 ;2、使用@Transactional注解的方式。 在本文中,我将会介绍第一种方式配置spring声明式事务管理。 首先,在我们使用spring声明式管理前,我们需要导入几个相关的jar包: 下面我们先编写我们的application.xml文件:<?xml vers
Spring AOP问题
我用Spring来管理struts2的action,如果不添加代理没有问题,但是添加AOP后就报错。但是如果是给DAO或者Service添加代理就没得问题……还请高手指教。rn未添加代理的配置为:rn[code=XML]rn rn [/code]rn添加代理后的配置:rn[code=XML]rn rn rn rn rn rn rn rn baseAroundAdvicern rn rn [/code]rn错误代码:rnStruts Problem ReportrnStruts has detected an unhandled exception:rnMessages: rn$Proxy6.Login()rnFile: java/lang/Class.javarnLine number: 1,605rnStacktracesrnrnjava.lang.NoSuchMethodException: $Proxy6.Login()rn java.lang.Class.getMethod(Class.java:1605)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)rn org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)rn org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)rn org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)rn org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)rn org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)rn java.lang.Thread.run(Thread.java:619)rn rn
spring中aop问题
最近在学习spring,当看到aop的时候,对他的配置文件有些模糊,希望大家给一些参考资料,主要是那里面的配置的意思是什么
spring aop 的问题
一个interface:rn[code=Java]rnpublic interface BuyBookrn public void buy();rnrn[/code]rnrn两个实现类:rn[code=Java]rnpublic class BuyBookImpl implements BuyBookrn public void buy()rn System.out.println("ChineseBook");rn rnrnpublic class BuyBookImpl2 implements BuyBookrn public void buy()rn System.out.println("EnglishBook");rn rn[/code]rnrnrn[code=XML]rnrn rn BuyBookrn rn rn rn rn ***rn rn rn rn rn rn rn rn[/code]rnrn那怎么在XML配置里让ProxyFactoryBean同时代理这两个类呢?rn
Spring AOP 的一个问题
我要实现一个功能,使用Spring AOP , 在Struts2 里Action 中的某个方法 执行之前,调用一个检查是否登录的方法。 比如已经登录了就执行 action 中的 save 方法, 如果没有登录则不执行 save 方法,而直接跳转到 error.jsp 请问这个功能怎么实现。rnrn大家简单的看看我的代码吧.rn[code=Java]rn rn rn rn rn rn rn rn rn[/code]rnrnLoginBefor.javarn[code=Java]rnpackage com.cgt.itspiderman.action.blog;rnrnimport java.io.IOException;rnimport java.util.Map;rnrnimport javax.servlet.http.HttpSession;rnrnimport org.apache.struts2.ServletActionContext;rnimport org.apache.struts2.dispatcher.mapper.ActionMapping;rnrnpublic class LoginBefor rnrn rn public String getUsername()rn rn rn HttpSession session = ServletActionContext.getRequest().getSession();rn rn String username =(String) session.getAttribute("username");rn rn if(null ==username || "" ==username)rn rn System.out.println("没登录"); rn try rn ServletActionContext.getResponse().sendRedirect("error.jsp");rn catch (IOException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn System.out.println("跳转了");rn rn return null; rn rnrnrnrn[/code]rnrn
Spring aop 问题
xml rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn--------------- rnpackage test; rnrnpublic interface Int_S rnpublic String getUsername(); rn rnrnrn-------------------- rnpackage test; rnrnpublic class Loger rnpublic void beforGetName(Int_S s) rnSystem.out.println("Before get user name"+s.getUsername()); rn rnrnpublic void afterGetName(Int_S s) rnSystem.out.println("After get user name"+s.getUsername()); rn rn rn---------------------------- rnpackage test; rnrnpublic class SImpl implements Int_S rnrnprivate String username="hxf"; rnrn@Override rnpublic String getUsername() rnreturn username; rn rnpublic void setUsername(String username) rnthis.username = username; rn rnrnpublic String getN() rn// TODO Auto-generated method stub rnreturn username; rn rnrn rn--------------------------------- rnpackage test; rnrnimport org.springframework.beans.factory.BeanFactory; rnimport org.springframework.beans.factory.xml.XmlBeanFactory; rnimport org.springframework.context.support.ClassPathXmlApplicationContext; rnimport org.springframework.core.io.FileSystemResource; rnrnpublic class Test rnpublic static void main(String[] d) rnBeanFactory factory = new XmlBeanFactory(new FileSystemResource("src/beanRefFactory.xml")); rn//BeanFactory factory = new ClassPathXmlApplicationContext("beanRefFactory.xml"); rnSImpl greetingServices =(SImpl)factory.getBean("S"); rnSystem.out.println( greetingServices.getUsername()); rn rn rnrn期望Loger能自动system out,.但是没反应..console 只输出 asdf rnrn我希望greetingServices.getUsername() 的时候 loger能自动输出
spring aop问题
[code=HTML]rnrn rn rn rn rn rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIRED,readOnlyrn rn rn rn[/code]rn怎么理解 rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIRED,readOnlyrn rn
Spring AOP 的基础问题
Spring 中使用Schema方式进行配置Spring切面时,可以使用一下两种方式:rn * rn * rnrn请问,这两种方式配置出来的切面有什么区别呢?rn一般常用哪一种方式呢,原因是什么?
spring aop报错问题
今天在使用spring的过程中,加入spring aop拦截之后总是报错。错误前面是Error creating bean with name 'org.springframework.context.event.internalEve等等等。发现是少了一个jar包造成的。解决方法是引入aspectweaver-1.5.3.jar。...
spring的Aop使用问题
今天写一个用aop进行拦截的功能。 spring:   实现类: @Component @Aspect public class JmsListenerAspect { /* * 配置前置通知,使用在方法aspect()上注册的切入点 * 同时接受JoinPoint切入点对象,可以没有该参数 */ @Before("execution(* utry.jms.s
spring aop的问题
配置文件有配置一个切面:rn[code=java]rnrn rn rn rn rn [/code]rnMindReader类:rn[code=java]public class MindReader implements Performerrn private String thoughts;rn public void readThoughts(String thoughts)rn this.thoughts=thoughts;rn System.out.println(thoughts);rn rn public void setThoughts(String thoughts)rn this.thoughts=thoughts;rn rn public String getThoughts()rn return this.thoughts;rn rn @Overridern public void perform() rn // TODO Auto-generated method stubrn System.out.println(getThoughts());rn rn[/code]rnAudience类:rn[code=java]public class Audiencern private String thoughts;rn public void takeSeat()rn System.out.println("audience take seat");rn rn rn public void turnOffPhone()rn System.out.println("please turn off phone");rn rn public void applaud()rn System.out.println("audience are applauding");rn rn public void thinkingSomething(String thoughts)rn this.thoughts=thoughts;rn rn public void setThought(String thoughts)rn this.thoughts=thoughts;rn rn public String getThoughts()rn return thoughts;rn rn[/code]rn测试的main函数:rnpublic static void main(String[] args)rn ApplicationContext context=new ClassPathXmlApplicationContext("springIdol.xml");rn Audience audience=(Audience)context.getBean("audience");rn audience.thinkingSomething("I love you"); rn rn不会报错,但是不会显示“I love you”
struts2和spring aop问题
[code=Java]package com.yb529.web.action.privilege;rnrnimport org.aspectj.lang.ProceedingJoinPoint;rnimport org.aspectj.lang.annotation.Around;rnimport org.aspectj.lang.annotation.Aspect;rnimport org.aspectj.lang.annotation.Before;rnimport org.aspectj.lang.annotation.Pointcut;rnimport org.springframework.stereotype.Component;rnrn@Aspectrn@Componentrnpublic class Interceptor rnrn @SuppressWarnings("unused")rn @Pointcut("execution(public * com.yb529.web.action..*.*(..))")rn private void actionMethod()rn rn @Around("actionMethod()")rn public Object interceptor(ProceedingJoinPoint pjp) throws Throwablern System.out.println("拦截到了"+pjp.getSignature().getName()+"方法");rn return pjp.proceed();rn rn[/code]rnrn为什么我用aop拦截action方法后,得不得jsp页面的数据了喃,后台也没有抛错rn不拦截完全正常,struts2.2.1 spring 3.0.5
spring aop切面问题
现在项目需要做审计日志,记录客户每个操作痕迹。项目使用SSH的框架,在Action层引入切面实现。代码如下rn[code=Java]rn @Before("execution(public * com.eto..*.*Action.* ())")rn public void beforeMethod(JoinPoint jp)rn rn // TODO Auto-generated method stubrn logger.info(" beforeMethod invoke name:"+jp.getClass().getName());rn logger.info(" beforeMethod invoke target:"+jp.getTarget().toString());rn logger.info(" beforeMethod invoke kind:"+jp.getKind());rn logger.info(" beforeMethod invoke Signature:"+jp.getSignature().getName());rn logger.info(" beforeMethod invoke sourceLocation:"+jp.getSourceLocation().toString());rn logger.info(" beforeMethod invoke getStaticPart:"+jp.getStaticPart().toString());rn logger.info(" beforeMethod invoke args:"+((jp.getArgs() != null && jp.getArgs().length >0 ) ? jp.getArgs()[0].toString():"无"));rn logger.info(" beforeMethod invoke this:"+jp.getThis().toString());rn rnrn[/code]rnrnAction类rn[code=Java]rn@Component("logicAction")rnpublic class LoginAction extends ActionSupport implements ServletRequestAware,rn ServletResponseAware rn private HttpServletRequest request;rn rn private HttpServletResponse response;rn rn public void setServletRequest(HttpServletRequest arg0) rn // TODO Auto-generated method stubrn request = arg0;rn rnrn public void setServletResponse(HttpServletResponse arg0) rn // TODO Auto-generated method stubrn response = arg0;rn rn rnrn public String login()rn StringBuffer sb = new StringBuffer();rn String operatorName = request.getParameter("userName");rn String password = request.getParameter("password");rn String userType = request.getParameter("userType");rn .............rn rnrnrnrn[/code]rn现在存在一个问题 action方法使用了struts2.0的架构,所有的action请求方法没有任何参数 JoinPoint对象不能获取到任何参数信息,现在需要通过request对象获取当前登录人信息及客户机ip等相关信息。在beforeMethod方法中如何获取容器的request对象?
spring aop log4j 问题
我有一个SSH 的项目现在要用 aop 为一些方法加上日志。比如用户登录,用户在注册页面输入一些注册信息后,提交到 UserAction 中。输入信息比如 userName, password, validateCode(验证码)。 在 UserAction 中有对应的 getter 和 setter 方法。rn在没有加入aop 的时候,运行正常。但加入aop 后,会出现问题。会报如下异常rnCaused by: No object in the CompoundRoot has a publicly accessible property named 'userName' (no setter could be found). - [unknown location]rnrnUnexpected Exception caught setting 'validateCode' on 'class $Proxy8: Error setting expression 'validateCode' with value ['sfsdfsdf', ]rnrnrn我的 aop 定义如下rn[code=java]rn rn rn rn rn rn rn rn rn[/code]rnrnLogAspect 类代码如下:rn[code=java]rnpublic class LogAspect rn private Logger logger = Logger.getLogger(LogAspect.class);rn String logContent = "";rn rn public LogAspect() rn super();rn rn rn public void doBefore(JoinPoint jp) rn logContent = "method start: " + jp.getTarget().getClass().getName() + ", " + rn jp.getSignature().getName();rn logger.warn(logContent);rn rn rn public void doAround(ProceedingJoinPoint pjp) rn System.out.println("do around");rn rn rn public void doAfter(JoinPoint jp) rn logContent = "method end: " + jp.getTarget().getClass().getName() + ", " + rn jp.getSignature().getName();rn rn logger.warn(logContent);rn rnrn[/code]rnrn完整异常信息如下:rn[code=java]rnERROR (CommonsLogger.java:38) - Developer Notification (set struts.devMode to false to disable this message):rnUnexpected Exception caught setting 'validateCode' on 'class $Proxy8: Error setting expression 'validateCode' with value ['aaa', ]rn Error setting expression 'validateCode' with value ['aaa', ] - [unknown location]rn at com.opensymphony.xwork2.ognl.OgnlValueStack.handleRuntimeException(OgnlValueStack.java:197)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:174)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:148)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:318)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:231)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)rn at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)rn at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)rn at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)rn at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)rn at java.lang.Thread.run(Thread.java:722)rnCaused by: No object in the CompoundRoot has a publicly accessible property named 'validateCode' (no setter could be found). - [unknown location]rn at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:106)rn at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2332)rn at ognl.ASTProperty.setValueBody(ASTProperty.java:127)rn at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)rn at ognl.SimpleNode.setValue(SimpleNode.java:301)rn at ognl.Ognl.setValue(Ognl.java:737)rn at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:234)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:183)rn at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:170)rn ... 59 morernrn[/code]rnrn请各位指点,小弟不胜感激。
Spring Aop 代理问题
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.MyServer.struts.action.CollectAddAction': Unsatisfied dependency expressed through bean property 'collectinfo': : No unique bean of type [com.MyServer.service.CollectInfoFace] is defined: expected single matching bean but found 2: [CollectInfoFace, CollectInfoImpl]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.MyServer.service.CollectInfoFace] is defined: expected single matching bean but found 2: [CollectInfoFace, CollectInfoImpl]rn org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1091)rn org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:982)rn org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)rn org.springframework.web.struts.AutowiringRequestProcessor.processActionCreate(AutowiringRequestProcessor.java:178)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:221)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)rn org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)rn org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)rn org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)rnrn[code=XML]rnrn rn com.MyServer.service.CollectInfoFacern rn rn rn rn logAdvicern rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rn按书上做的出错了,帮忙看看 谢谢
spring 中的AOP 问题
请问 在Spring的配置文件中 配置了AOP 还需要在Java类里面写方面代码吗?比如:rnrnpublic class LogAdvice implements MethodBeforeAdvice rn private static DateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 hh时mm分ss秒");rn rn public void before(Method arg0, Object[] arg1, Object arg2)rn throws Throwable rn System.out.println("\n[系统日志]["+sdf.format(new Date())+"]"rn +arg0.getName()+"("+Arrays.toString(arg1)+")");rn rnrnrnrn还需要写吗?
请教Spring的AOP的问题!
在SSH项目中,用Spring的AOP拦截Action,Spring的配置大致如下:rnrnrnrnrn这种方式有个问题rnrn凡是符合条件的方法都会被织入,假设某个时间段要执行的add方法比较多,我如何取得某一瞬时是哪个类的add方法调用了切面方法。rn
spring aop参数传递的问题
业务类nn```n public void sell(Book book)n System.out.println("sell");n n```n切面类nn```n //这里sell参数类型为什么不可以是Bookn @Pointcut("execution(* aop.library.BookShop.sell(Book))"+"&&"+"args(book)")n public void sell(Book book)n @Before("sell(book)")n public void charge(Book book)n System.out.println("这本书叫:"+book);n n```n错误:nn```n Caused by: java.lang.IllegalArgumentException: warning no match for this type name: Book [Xlint:invalidAbsoluteTypeName]n at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:301)n```n但是把@Pointcut("execution(* aop.library.BookShop.sell(Book))"+"&&"+"args(book)")中的Book改成* 或者..就可以了n可是BookShop.sell(Book)是接受Book参数的啊n为什么会报错?nnnnnn
Spring Aop 事务问题
今天在学习spring中碰到了一个问题,在使用spring Aop进行简易转账事物操作的时候,如果业务流程正常则结果没有问题,而如果在代码中书写一段异常代码按理来说是会事物回滚,而我的代码执行结果是汇款方汇出了钱,但是收款方却没有收到,也就是事务没有回滚,这个问题困扰了我一下午,终于在晚上的时候找到了原因,下面给大家分享一下代码. 1.dao层接口及实现类. 2.service层接口及实现类 ...
关于Spring AOP的问题
为什么我程序移植下就出错了,代码是这样,移植前就对的rnrnrnrn rnrn rn rn rn rn rn rn rn rn rn rn rn beforrn rn rn rn rn
spring Aop 的问题
在sping中用aop进行异常捕获:rn[code=Java]rnpublic class AopExceptionHandler implements ThrowsAdvice rnrnpublic void afterThrowing(Method method, Object[] args, Object target,rn Exception ex ) throws Throwable rn System.out.println(target.getClass().getName());rn for (int i = 0; i < args.length; i++) rn System.out.println("args["+i+"]:"+args[i]);rn rn System.out.println("Exception class: " + ex.getClass().getName());rn System.out.println("执行:" + method.getName() + "时发生异常:"+ex);// 输出异常信息rn System.out.println("执行:" + method.getName() + "时发生异常:"+ex.getLocalizedMessage());// 输出异常信息rn System.out.println("执行:" + method.getName() + "时发生异常:"+ex.getMessage());// 输出异常信息rn System.out.println("执行:" + method.getName() + "时发生异常:"+ex.fillInStackTrace());// 输出异常信息rn System.out.println("异常信息打印结束!");rn rn rnrnrnrn[/code]rnrn我现在就想得到异常详细信息 然后存到数据库里去 ,而这里我只能得到异常名字,这样是没有什么意义的.rnrnargs[0]:-1rnException class: java.lang.NullPointerExceptionrn执行:findTreeRootJson时发生异常:java.lang.NullPointerExceptionrn执行:findTreeRootJson时发生异常:nullrn执行:findTreeRootJson时发生异常:nullrn执行:findTreeRootJson时发生异常:java.lang.NullPointerExceptionrn异常信息打印结束!rnrn上面是异常出现时打印的信息rnrn我想得到控制台中打印的详细信息
spring AOP的问题
最近在看spring AOPrn做测试发现下面一个问题 rn这是daorn[code=Java]rn@Component("userDao")rnpublic class UserDaoImpl implements UserDao rnrn public void addUser(User user) rn // TODO Auto-generated method stubrn System.out.println("this is add method!");rn rnrn public void delUser() rn // TODO Auto-generated method stubrn System.out.println("this is delete method!");rn rnrnrnrn[/code]rnrn--------------用的是annotation注入-----------------------rn下面是service代码 注入userdaornrn[code=Java]rn @Component("service.userService")rnpublic class UserService rnrn public UserDao userDao;rn public UserDao getUserDao() rn return userDao;rn rn rn @Resourcern public void setUserDao( UserDao userDao) rn this.userDao = userDao;rn rn rn rn public void addUser(User user)rn rn this.userDao.addUser(user);rn rn rn rn public void delUser()rn this.userDao.delUser();rn rnrnrn[/code]rnrn-----------------------rn这是我的Test类rnrn[code=Java]rn public class Test rn rn public static void main(String[] args)rn ApplicationContext app=new ClassPathXmlApplicationContext("applicationContext.xml");rn UserService us=(UserService) app.getBean("service.userService");rn us.addUser(new User());rn us.delUser();rn rnrnrnrn[/code]rnrnrn----------切面----------rnrn[code=Java]rnrn@Aspectrn@Componentrnpublic class LogAop rn rn @Before("execution( public void com.xiao.springsimulate.dao.UserDao.addUser(com.xiao.springsimulate.model.User))")rn public void before()rn System.out.println(" i am befor the add method");rn rnrnrnrn[/code]rnrn运行应该会打出rni am befor the add methodrnhis is add method!rnthis is delete method!rnrn可以不会打印第一句 只打印后面两句rnrn不知道什么原因 rn这是我的xml文件rnrn[code=XML]rnrnrnrnrn rn rn rn rn rn rnrnrnrn[/code]rnrnrn以及后台输出的信息rnrn[code=Java]rn2010-7-12 10:52:03 org.springframework.context.support.AbstractApplicationContext prepareRefreshrn信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@ecd7e: display name [org.springframework.context.support.ClassPathXmlApplicationContext@ecd7e]; startup date [Mon Jul 12 10:52:03 CST 2010]; root of context hierarchyrn2010-7-12 10:52:04 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitionsrn信息: Loading XML bean definitions from class path resource [applicationContext.xml]rn2010-7-12 10:52:04 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactoryrn信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@ecd7e]: org.springframework.beans.factory.support.DefaultListableBeanFactory@766a24rn2010-7-12 10:52:04 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletonsrn信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@766a24: defining beans [org.springframework.aop.config.internalAutoProxyCreator,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,userDao,service.userService]; root of factory hierarchyrnthis is add method!rnthis is delete method!rnrnrn[/code]rnrnrn帮忙看下 谢谢 rnrnrnrnrnrnrn
Spring AOP 问题
applicationContext.xmlrn[code=Java]rnrnrn rn rn rn rn rn rn rn rn rnrn rnrn rn rn rn rn rn rnrn rn rn com.aptech.jb.epet.dao.PetInfoDaorn rn rn rn LotteryAdvicern rn rn rn rnrn[/code]rnrnrnPetInfoDao接口rn[code=Java]rnpackage com.aptech.jb.epet.dao;rnrnimport java.util.List;rnimport com.aptech.jb.epet.entity.PetInfo;rnrnpublic interface PetInfoDao rn // 根据编号查找单个宠物信息rn public PetInfo load(Integer id);rnrn // 更新宠物信息rn public void update(PetInfo petInfo);rnrn // 查找所有宠物信息rn public List selectAll();rnrn // 增加一条宠物信息rn public void insertPetInfo(PetInfo petInfo);rnrn // 验证信息rn public PetInfo userValidate(String petId, String petPassword);rnrn // 喂养宠物rn public void doTraining(Integer petId, String Training);rnrn // 根据条件查找宠物信息rn public List search(PetInfo condition, String orderBy);rnrn[/code]rnrnrn
Spring AOP的问题请教
Spring AOP源码中的ProxyFactoryBean类有两种方式产生代理类,分别是getSingletonInstance()和 newPrototypeInstance(),请求各位大神这二者的区别是什么,在什么场景下会用到,尤其是rnnewPrototypeInstance() 在什么场景会用
Spring Aop相关问题
先上代码,对代码进行详细介绍然后再引入相关的概念问题。 组建代码的时候出现了许多问题:例如:Error occured processing XML 'org/springframework/aop/aspectj/AspectJMethodBeforeAdvice'. See Error Log for more details。对于这个问题是缺少三种jart包,分别是Aspectjrt,
Spring AOP时的问题
http://stackoverflow.com/questions/16914623/aspectj-and-nosuchbeandefinitionexception-at-least-1-bean-which-qualifies-as-aut 需要加入 proxy-target-class="true" 没有加入proxy-target-class="true"之前能运行
Spring aop的问题
我现在要实现的是用Spring的aop截获struts的action里面的方法,不知道为什么,总是截不到?还请大侠们帮忙!!rn补充:rn1.struts是在spring的控制下的,即配置在了action_servlet.xml中了。rn2.spring aop用到的是aspectJ的自动配置风格,spring2.0的语法
Spring aop问题
我现在要实现的是用Spring的aop截获struts的action里面的方法,不知道为什么,总是截不到?还请大侠们帮忙!! rn补充: rn1.struts是在spring的控制下的,即配置在了action_servlet.xml中了。 rn2.spring aop用到的是aspectJ的自动配置风格,spring2.0的语法
Spring AOP传递参数的问题
我的通知中需要用到被通知对象的参数,如何传递这个参数呢?我使用arg-names传递参数但是报错了。rn代码如下rn这是被通知对象rnpublic boolean SaveNewBlog(int Id, Blog blog) rn boolean b = false;rn try rn java.util.Date date = new java.util.Date();rn blog.setUserId(Id);rn blog.setBlogDay(new java.sql.Date(date.getTime()));rn blog.setBlogTime(new java.sql.Time(date.getTime()));rn template.save(blog);rn b = true;rn catch (Exception e) rn e.printStackTrace();rn b = false;rn finally rn return b;rn rn rn这是通知rnpublic void AfterSaveBlog(int Id) throws Throwable rn java.util.Date d = new java.util.Date();rn UserAction ua=new UserAction();rn ua.setUsersId(Id);rn ua.setActionType("blog");rn ua.setActionDay(new java.sql.Date(d.getTime()));rn ua.setActionTime(new java.sql.Time(d.getTime()));rn template.save(ua);rn rnrn我的applicationContext.xml中关于切面的配置如下rn rn rn rn rn rn rn rnrn测试方法如下:rnpublic void testSaveNewBlog() rn BlogDao blogdao=new BlogDaoImpl();rn Blog blog = new Blog();rn java.util.Date d = new java.util.Date();rn blog.setUserId(1);rn blog.setBlogTitle("111");rn blog.setBlogText("222");rn blog.setBlogDay(new java.sql.Date(d.getTime()));rn blog.setBlogTime(new java.sql.Time(d.getTime()));rn blogdao.SaveNewBlog(1, blog);rn rn
关于SPRING的AOP的问题
最近想用SPRING的AOP结合STRUTS1来使用,但是遇到些问题,请教,我的applicationContext.xml文件如下rnrnrnrn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIRED,readOnlyrn rn rn rn rnrn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn /employeern rn rn rn rn rn authorityInterceptorrn rn rn rn rnrn我希望通过AuthorityInterceptor来拦截STRUTS的>/employee请求。rnSTRUTS-CONFIG.XML文件中的ACTION是这样写的rn rn rn rn当我把工程部署到TOMCAT的时候,报错提示rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name '/employee' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Vrn还有rnCaused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Vrn我以为是导入的ASM包有冲突,但是删了一些ASM的包,还是没有用rn请问哪位知道为什么,是导入的包有问题,还是我写的AOP有问题。
关于spring的aop问题?
最近在学习spring的aop,自己做了个例子,但是总是不能正常的运行!rn我们的一个项目是基于 webwork + hibernate + spring做的。rn前台页面会调用webwork定义的各种action方法,我们自己写的每个类都实现了webwork的Action借口,但是该接口只有一个方法,就是execute()。rn我目前想用spring的aop来记录用户调用的各个action方法,具体的.xml定义如下:rn[code=Java]rn rn rn rn rn rn rn rn rn rn rn rn rn com\.opensymphony\.xwork\.Action\.executern rn rn rn rn rn rn com.opensymphony.xwork.Actionrn rn rn rn doBeforeActionAdvicern rn rn rn rn rn rn[/code]rn哪为能给个基础点的例子,让我这个初学者能明白就成,还有就是帮我看看这东西该怎么配,谢谢!!!
spring aop 问题
applicationContext.xmlrn[code=XML]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rnSecurityHandler.javarn[code=Java]rnpackage com.samba.spring;rnrnpublic class SecurityHandler rnrn private void addcheckSecurity() rn System.out.println("----------addcheckSecurity()---------------");rnrn rnrn private void delcheckSecurity() rn System.out.println("----------delcheckSecurity()---------------");rnrn rnrnrnrn[/code]rnrnClientrn[code=Java]rnpackage com.samba.spring;rnrnimport org.springframework.beans.factory.BeanFactory;rnimport org.springframework.context.support.ClassPathXmlApplicationContext;rnrnpublic class Client rnrn public static void main(String[] args) rn rn BeanFactory factory = new ClassPathXmlApplicationContext("applicationContext.xml");rn UserManager userManager = (UserManager)factory.getBean("userManager");rn rn userManager.addUser("张三", "123");rn userManager.deleteUser(1);rn rn rnrnrn[/code]rnrn[code=XML]rn2010-04-06 09:17:32,046 INFO [org.springframework.core.CollectionFactory] - JDK 1.4+ collections availablern2010-04-06 09:17:32,250 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [applicationContext.xml]rnException in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Line 20 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'aop:pointcut'. One of '"http://www.springframework.org/schema/aop":before, "http://www.springframework.org/schema/aop":after, "http://www.springframework.org/schema/aop":after-returning, "http://www.springframework.org/schema/aop":after-throwing, "http://www.springframework.org/schema/aop":around' is expected.rnCaused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'aop:pointcut'. One of '"http://www.springframework.org/schema/aop":before, "http://www.springframework.org/schema/aop":after, "http://www.springframework.org/schema/aop":after-returning, "http://www.springframework.org/schema/aop":after-throwing, "http://www.springframework.org/schema/aop":around' is expected.rn at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)rn at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)rn at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)rn at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)rn at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)rn at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)rn at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1777)rn at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:705)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)rn at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)rn at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)rn at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:405)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:357)rn at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)rn at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:168)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)rn at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)rn at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:92)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:77)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:68)rn at com.samba.spring.Client.main(Client.java:10)rnrn[/code]rn
Spring aop 原理问题
我是一个初学者,想问一下aop包装类在前,还是bean注入在前?rn配置文件如下:rnrnrnrn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rnrn rnrn rn rnrn rn rnrnn[b]问题补充:[/b]n对,就是系统初始化时,是AOP包装类先初始化,还是注入的bean先初始化?n[b]问题补充:[/b]n顺便问一句,我这么配置的时候,Service层用@Transactional无法拦截事务,事务没有回滚,是怎么回事啊?rn
跪求spring AOP 问题
先看代码:rn rn rn rn rn rn rn do*rn rn rn rn rn rn *Actionrn rn rn rn theActionInterceptorrn rn rn rn rnrn我想做的事情是:拦截所有以Action结尾的bean中的do*的方法。rn现在的问题是:我把Action中调的service中的do*的方法也给拦截了(就比如aAction中调用了bService中的doSomething()方法),怎么办?
spring Aop 问题
[code=Java]rnpackage com.spring.Iservice;rnrnimport com.spring.Idao.IDao;rnrnpublic class ServiceImpl implements IService rn private IDao dao; //定义一个Idao对象rn rn public void service(String name) //实现service()方法rn System.out.println(dao.sayHello(name)); //调用IDao接口的方法rn rnrn public IDao getDao() //getter方法rn return dao;rn rnrn public void setDao(IDao dao) //setter方法rn this.dao = dao;rn rn rnrnrn[/code]rn[code=Java]rnpackage com.spring.test;rnrnimport org.springframework.beans.factory.xml.XmlBeanFactory;rnimport org.springframework.context.ApplicationContext;rnimport org.springframework.context.support.ClassPathXmlApplicationContext;rnimport org.springframework.core.io.ClassPathResource;rnrnimport com.spring.Iservice.IService;rnrnpublic class SpringTest rn public static void main(String[] args) rn XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); //加载配置文件rn IService service = (IService)factory.getBean("serciceImpl"); //从配置文件中获取信息rn service.service("lishi"); //执行service方法rn factory.destroySingletons(); //销毁beanrn rnrnrn[/code]rn[code=Java]package com.spring.test;rnrnpublic class ServiceExample rn DaoExample example = new DaoExample();rn public void service(String name)rn System.out.println(example.sayHello(name));rn rnrn[/code]rn[code=Java]rnpackage com.spring.Iservice;rnrnpublic interface IService rn public void service(String name);rnrn[/code]rn[code=Java]rnpackage com.spring.Idao;rnrnpublic interface IDao rn public String sayHello(String name);rnrn[/code]rn[code=Java]rnpackage com.spring.Idao;rnrnimport java.util.Calendar;rnrnpublic class DaoImpl implements IDaornrn public String sayHello(String name) rn int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);rnrn if(hour< 6)return"凌晨好,"+name;rn if(hour< 12) return"上午好,"+name;rn if(hour< 13) return"中午好,"+name;rn if(hour< 18) return"下午好,"+name;rn return "晚上好"+name;rn rn rnrn[/code]rn[code=XML]rnrnrnrn rn rn rn rn rn rn rnrnrn rn rn rn rn rnrn rn rn rn rn rn rnrn rnrn[/code]rn
spring AOP 问题
Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: error at ::0 formal unbound in pointcut rnrnrn
spring aop应用的问题
实现目标:在action中调用DefaultStudentDAO 的 findByNo() 方法前进行拦截输出一条日志信息.(spring+hibernate+sturts的实现)rnrnAOP相关的配置:rnrnrn xxx.xxx.xxx.dao.StudentDAOrnrnrn rnrnrn rn stuQueryLogAdvisorrn rnrnrn rnrn rn rn rn rn .*find.*rn rnrn rnmethod:"+m.getName()+rn " target:"+target.getClass().getName());rnrnrnrnstruts action相关配置:rnrn rn rn rnrnrnQueryStuInfoAction:rn public ActionForward execute(rn ActionMapping mapping,rn ActionForm form,rn HttpServletRequest request,rn HttpServletResponse response) rn QueryStuInfoForm queryStuInfoForm = rn (QueryStuInfoForm)form;rn // TODO Auto-generated method stubrn List result = new ArrayList();rn String num = queryStuInfoForm.getStuNo();rn tryrn rn result = defStuDAO.findByNo(num);rn request.setAttribute("studentList",result);rn catch(Exception e)rn e.printStackTrace();rn return mapping.findForward(Constants.FAILURE_KEY);rn rn return mapping.findForward(Constants.SUCCESS_KEY);rnrnrn现在StudentQueryBeforeAdvic中的记录日志的功能没有起作用,应该怎么样才能实现目标?需要对"stuQueryLog"这个bean做处理吗?请高手指教,谢谢!! rn
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法