NutzCN Logo
问答 关于事物的配置未生效
发布于 3256天前 作者 Rekoe 2086 次浏览 复制 上一个帖子 下一个帖子
标签: dao 事务

内容支持 Markdown 语法, 使用菜单栏的代码块标注代码,不要上传代码的截图!!
直接上代码
MainModule 已加载

"*trans"
var ioc = {
	log : {
		type : 'org.nutz.aop.interceptor.LoggingMethodInterceptor'
	},$aop : {
		type : 'org.nutz.ioc.aop.config.impl.JsonAopConfigration',
		fields : {
			itemList : [
					[ '.+', 'toString', 'ioc:log' ],
					[ 'com\\.xxx\\.proxy\\.database\\..+', '(insert|update|get)+','ioc:txREPEATABLE_READ' ]
				]
		}
	}
}

现在是执行get update insert 操作的时候走不到事物的执行方法 不晓得是哪里问题

17 回复

@wendal
和方法是 protected 类型有关系么

把堆栈贴一下

来自炫酷的 NutzCN

我debug 加的断点

找个理应生效的方法,加入这样的语句

···
new Throwable().printStackTrace();
···

new Throwable().printStackTrace();

@webdal

2015-12-18 09:38:09,302 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - UPDATE sg_user SET last_login_time=?  WHERE id=?
    |                   1 |                                2 |
    |---------------------|----------------------------------|
    | 2015-12-18 09:38:09 | 4f39d6ed623d4ac7939877c012b56396 |
  For example:> "UPDATE sg_user SET last_login_time='2015-12-18 09:38:09'  WHERE id='4f39d6ed623d4ac7939877c012b56396'"
java.lang.Throwable
	at com.shanggame.proxy.database.DBProxy.update(DBProxy.java:128)
	at com.shanggame.db.service.impl.UserService.update(UserService.java:65)
	at com.shanggame.db.service.impl.LoginServiceImpl.login(LoginServiceImpl.java:81)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:302)
	at com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:198)
	at com.shanggame.plugins.msgpack.mvc.adaptor.HessianAdaptor.invoke(HessianAdaptor.java:61)
	at com.shanggame.plugins.msgpack.mvc.adaptor.HessianAdaptor.getReferObject(HessianAdaptor.java:80)
	at com.shanggame.plugins.msgpack.mvc.adaptor.HessianAdaptor.getReferObject(HessianAdaptor.java:1)
	at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:216)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:40)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:119)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:179)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
2015-12-18 09:38:09,314 [DEBUG][org.nutz.dao.impl.sql.run.NutDaoExecutor] - SELECT * FROM sg_role  WHERE uid=? LIMIT 0, 1 

匹配方法的正则表达式写错了

来自炫酷的 NutzCN

com.xxxx.proxy.database.DBProxy(abstract)

[ 'com\\.xxx\\.proxy\\.database\\..+', '(update|insert)+','ioc:txREPEATABLE_READ' ]

@wendal
错了么

@Rekoe 你可以试试那个正则表达式能不能匹配update

来自炫酷的 NutzCN

@wendal
不能

去掉末尾的加号

来自炫酷的 NutzCN

不行
奇怪
我改成别的目录下可以 这个目录下不行

@wendal
监听

UserService extends DBProxy<UserEntity>

这个类中的update 方法可以
这个类中的update 方法监听不到

这个类 DBProxy 中的update 方法监听不到

额,父类的方法?待我查查

来自炫酷的 NutzCN


你试试抽象类 private protected 方法 好像都不能捕获到
@wendal

刚刚测试了一下, protected方法是可以的,private的话那是肯定不行的。

java.lang.Throwable
	at net.wendal.nutzbook.module.BaseModule.ajaxOk(BaseModule.java:56)
	at net.wendal.nutzbook.module.BaseModule.init(BaseModule.java:75)
	at net.wendal.nutzbook.module.admin.AdminLoginModule$$NUTZAOP._aop_invoke(AdminLoginModule.java:1)
	at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
	at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at net.wendal.nutzbook.module.admin.AdminLoginModule$$NUTZAOP.init(AdminLoginModule.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:74)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)
添加回复
请先登陆
回到顶部