Closed PercyChuang closed 7 years ago
@changmingxie 消息者和提供都用的是不同数据库,操作的表tcc_transcationxx都有数据。。。
@PercyChuang getInstance() 不应该是走到instance==null这个分支,看看TccInterface是否已经注入到spring的容器中, 应该是拿spring 容器中的 实例。看看tcc-transaction.xml是否加载正确
@changmingxie INFO [dms-ervice] 2017-08-31 15:03:20.676 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [tcc-transaction.xml] 就加载了的。
@changmingxie 两个XML都已加载正确。 INFO [dms-ervice] 2017-08-31 15:07:13.739 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [tcc-transaction.xml] INFO [dms-ervice] 2017-08-31 15:07:13.816 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [tcc-transaction-dubbo.xml]
@PercyChuang @service("tccImpl") 是不是 应该@Service? 感觉是没有注入正确
我定义了接口: public interface TccInterface {
}
在dubbo中的配置:
具体的实现类:
@Service("tccImpl") public class TccImpl implements TccInterface {
}
文档中所涉及到的几处操作包括: 【已完成】 1.在pom.xml文件中加入依懒 2.引入两个xml配置 3.设置transactionRepository和独立的数所源
启动服务端没有问题 在dubboAdmin上可以看到注册信息。
消息者调用服务时,异常出现:try ok confirm出现
2017-08-31 13:44:07:983[ERROR][org.mengyun.tcctransaction.TransactionManager.commit(TransactionManager.java:67)] - compensable transaction confirm failed. org.mengyun.tcctransaction.SystemException: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface at org.mengyun.tcctransaction.Terminator.invoke(Terminator.java:41) at org.mengyun.tcctransaction.Participant.commit(Participant.java:53) at org.mengyun.tcctransaction.Transaction.commit(Transaction.java:88) at org.mengyun.tcctransaction.TransactionManager.commit(TransactionManager.java:64) at org.mengyun.tcctransaction.interceptor.CompensableTransactionInterceptor.rootMethodProceed(CompensableTransactionInterceptor.java:96) at org.mengyun.tcctransaction.interceptor.CompensableTransactionInterceptor.interceptCompensableMethod(CompensableTransactionInterceptor.java:62) at org.mengyun.tcctransaction.interceptor.CompensableTransactionAspect.interceptCompensableMethod(CompensableTransactionAspect.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.eoc.dms.service.impl.tcc.TccImpl$$EnhancerBySpringCGLIB$$3da6bd61.insert()
at com.alibaba.dubbo.common.bytecode.Wrapper2.invokeMethod(Wrapper2.java)
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:48)
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:77)
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:57)
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:58)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:43)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:79)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:57)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:106)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:39)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:40)
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100)
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:114)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:88)
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:178)
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:53)
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface
at org.mengyun.tcctransaction.support.FactoryBuilder$SingeltonFactory.getInstance(FactoryBuilder.java:69)
at org.mengyun.tcctransaction.Terminator.invoke(Terminator.java:30)
... 44 more
Caused by: java.lang.InstantiationException: com.eoc.dms.register.TccInterface
at java.lang.Class.newInstance(Class.java:359)
at org.mengyun.tcctransaction.support.FactoryBuilder$SingeltonFactory.getInstance(FactoryBuilder.java:67)
... 45 more
ERROR [dms-ervice] 2017-08-31 13:44:07.999 [DubboServerHandler-192.168.171.77:2181-thread-4] com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 192.168.171.77. service: com.eoc.dms.register.TccInterface, method: insert, exception: org.mengyun.tcctransaction.ConfirmingException: org.mengyun.tcctransaction.SystemException: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface, dubbo version: 0.1.0-SNAPSHOT, current host: 127.0.0.1
org.mengyun.tcctransaction.ConfirmingException: org.mengyun.tcctransaction.SystemException: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface
at org.mengyun.tcctransaction.TransactionManager.commit(TransactionManager.java:68) ~[classes/:na]
at org.mengyun.tcctransaction.interceptor.CompensableTransactionInterceptor.rootMethodProceed(CompensableTransactionInterceptor.java:96) ~[classes/:na]
at org.mengyun.tcctransaction.interceptor.CompensableTransactionInterceptor.interceptCompensableMethod(CompensableTransactionInterceptor.java:62) ~[classes/:na]
at org.mengyun.tcctransaction.interceptor.CompensableTransactionAspect.interceptCompensableMethod(CompensableTransactionAspect.java:28) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_67]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_67]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_67]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_67]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621) ~[spring-aop-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610) ~[spring-aop-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) ~[spring-aop-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) ~[spring-aop-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.3.RELEASE.jar:4.1.3.RELEASE]
at com.eoc.dms.service.impl.tcc.TccImpl$$EnhancerBySpringCGLIB$$3da6bd61.insert() ~[spring-core-4.1.3.RELEASE.jar:na]
at com.alibaba.dubbo.common.bytecode.Wrapper2.invokeMethod(Wrapper2.java) ~[na:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:48) ~[worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:77) ~[worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:57) ~[worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:58) ~[worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:43) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:79) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:57) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:106) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:39) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:40) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:100) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:114) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:88) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:178) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:53) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:86) [worf-remoting-dubbo-0.1.0-SNAPSHOT.jar:0.1.0-SNAPSHOT]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_67]
Caused by: org.mengyun.tcctransaction.SystemException: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface
at org.mengyun.tcctransaction.Terminator.invoke(Terminator.java:41) ~[classes/:na]
at org.mengyun.tcctransaction.Participant.commit(Participant.java:53) ~[classes/:na]
at org.mengyun.tcctransaction.Transaction.commit(Transaction.java:88) ~[classes/:na]
at org.mengyun.tcctransaction.TransactionManager.commit(TransactionManager.java:64) ~[classes/:na]
... 41 common frames omitted
Caused by: java.lang.RuntimeException: Failed to create an instance of com.eoc.dms.register.TccInterface
at org.mengyun.tcctransaction.support.FactoryBuilder$SingeltonFactory.getInstance(FactoryBuilder.java:69) ~[classes/:na]
at org.mengyun.tcctransaction.Terminator.invoke(Terminator.java:30) ~[classes/:na]
... 44 common frames omitted
Caused by: java.lang.InstantiationException: com.eoc.dms.register.TccInterface
at java.lang.Class.newInstance(Class.java:359) ~[na:1.7.0_67]
at org.mengyun.tcctransaction.support.FactoryBuilder$SingeltonFactory.getInstance(FactoryBuilder.java:67) ~[classes/:na]
跟踪到报异常位置:
org.mengyun.tcctransaction.support.FactoryBuilder
public T getInstance() {
上面的className值是:com.eoc.dms.register.TccInterface
当:(T) clazz.newInstance(); 报错。
凝问 这是因为代理导致的问题?,,还是本身在使用反射时某种情况的bug? 我们框架的数据源是动态数据源如下: `