Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HikariDataSource (HikariPool-1) is not DataSourceProxy, please correct the config! #142

Open
lvchongyi opened this issue Jan 8, 2020 · 2 comments

Comments

@lvchongyi
Copy link

你好!请教个问题。。。
我执行easytrans-demo下的tcc-and-fescar这个demo,
当调用tccandfescar-coupon-service这个服务时候。
这个方法AbstractAutoCpsMethod.doAutoCpsCommit提示错误:
java.lang.RuntimeException: HikariDataSource (HikariPool-1) is not DataSourceProxy, please correct the config!

这是application.yml的数据库配置:
spring:
application:
name: coupon-service
datasource:
url: jdbc:mysql://vdapp117:3306/coupon?characterEncoding=UTF-8&useSSL=false
username: admin
password: admin
driver-class-name: com.mysql.jdbc.Driver

这是完整的报错日志:
java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at com.yiqiniu.easytrans.rpc.impl.rest.RestRibbonEasyTransRpcProviderImpl$1.invoke(RestRibbonEasyTransRpcProviderImpl.java:96) ~[classes/:na]
at com.yiqiniu.easytrans.filter.DefaultEasyTransFilterFactory$InnerFilterChainImpl.invokeFilterChain(DefaultEasyTransFilterFactory.java:81) ~[classes/:na]
at com.yiqiniu.easytrans.idempotent.DefaultIdempotentHandlerFilter$1.doInTransaction(DefaultIdempotentHandlerFilter.java:75) ~[classes/:na]
at com.yiqiniu.easytrans.idempotent.DefaultIdempotentHandlerFilter$1.doInTransaction(DefaultIdempotentHandlerFilter.java:57) ~[classes/:na]
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at com.yiqiniu.easytrans.idempotent.DefaultIdempotentHandlerFilter.invoke(DefaultIdempotentHandlerFilter.java:57) ~[classes/:na]
at com.yiqiniu.easytrans.filter.DefaultEasyTransFilterFactory$InnerFilterChainImpl.invokeFilterChain(DefaultEasyTransFilterFactory.java:81) ~[classes/:na]
at com.yiqiniu.easytrans.filter.ParentTrxStatusUpdateFilter.invoke(ParentTrxStatusUpdateFilter.java:63) ~[classes/:na]
at com.yiqiniu.easytrans.filter.DefaultEasyTransFilterFactory$InnerFilterChainImpl.invokeFilterChain(DefaultEasyTransFilterFactory.java:81) ~[classes/:na]
at com.yiqiniu.easytrans.filter.MetaDataFilter.invoke(MetaDataFilter.java:41) ~[classes/:na]
at com.yiqiniu.easytrans.filter.DefaultEasyTransFilterFactory$InnerFilterChainImpl.invokeFilterChain(DefaultEasyTransFilterFactory.java:81) ~[classes/:na]
at com.yiqiniu.easytrans.rpc.impl.rest.RestRibbonEasyTransRpcProviderImpl.easyTransMethods(RestRibbonEasyTransRpcProviderImpl.java:114) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:981) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:884) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:858) [spring-webmvc-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.37.jar:8.5.37]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.37.jar:8.5.37]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_161]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.37.jar:8.5.37]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
Caused by: java.lang.RuntimeException: HikariDataSource (HikariPool-1) is not DataSourceProxy, please correct the config!
at com.yiqiniu.easytrans.protocol.autocps.AbstractAutoCpsMethod.doAutoCpsCommit(AbstractAutoCpsMethod.java:60) ~[classes/:na]
... 70 common frames omitted

@skyesx
Copy link
Contributor

skyesx commented Jan 18, 2020

你后面已经可以运行了,这个问题是否已经解决?

@lvchongyi
Copy link
Author

1、我再CouponApplication类里面使用seata的数据库代理bean:
@bean
public DataSource dataSourceProxy() {

	DruidDataSource druidDataSource = new DruidDataSource();
	druidDataSource.setUrl("jdbc:mysql://vdapp117:3306/coupon?characterEncoding=UTF-8&useSSL=false");
	druidDataSource.setUsername("admin");
	druidDataSource.setPassword("admin");

	return new DataSourceProxy(druidDataSource);
}

2、com.yiqiniu.easytrans.protocol.autocps.EtDataSourceManager
这个类的initEtDataSourceManager方法里面重新注册了ET的AT模式的Resource
public static void initEtDataSourceManager() {
Map<String, Resource> ResourcesMap = DefaultResourceManager.get().getResourceManager(BranchType.AT).getManagedResources();
DefaultResourceManager.mockResourceManager(BranchType.AT, new EtDataSourceManager());
LOGGER.info("-------------Trigger EtSeataDataSourceManager init start!");
if(ResourcesMap.size()==0){
LOGGER.info("-------------Trigger EtSeataDataSourceManager init failed: DataResource is null.");
}else{
Resource resource = ResourcesMap.values().iterator().next();
DefaultResourceManager.get().getResourceManager(BranchType.AT).registerResource(resource);
LOGGER.info("-------------Trigger EtSeataDataSourceManager init succeed: "+resource.getBranchType()+" "+resource.getResourceId()+" "+resource.getResourceGroupId());
}
}

现在可以不报错了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants