Closed cashZhang27 closed 5 years ago
Hi @cashZhang27, we detect non-English characters in the issue. This comment is an auto translation from @fescar-robot to help other users to understand this issue. We encourage you to describe your issue in English which is more friendly to other users.
When I use the following dependencies and @EnableOAuth2Client
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
If there is an exception, please attach the exception trace:
![4270FAF3-BD4A-4fe0-BFF1-DE601103B52F](https://user-images.githubusercontent.com/30404342/58884488-1cdec280-8713-11e9-88ae-f1a9c01c355d.png)
how to reproduce the issue?
how to reproduce the issue?
@leizhiyuan For example, Use the following dependencies and @EnableOAuth2Client to start an error in the seata-samples order application,The picture above the error log can be seen,Sorry, my English is very bad,,,
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
how to reproduce the issue?
@leizhiyuan For example, Use the following dependencies and @EnableOAuth2Client to start an error in the seata-samples order application,The picture above the error log can be seen,Sorry, my English is very bad,,,
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>2.3.3.RELEASE</version> </dependency>
It seems it's not the problem of seata,but like dependency conflicts.
how to reproduce the issue?
@leizhiyuan For example, Use the following dependencies and @EnableOAuth2Client to start an error in the seata-samples order application,The picture above the error log can be seen,Sorry, my English is very bad,,,
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> <dependency> <groupId>org.springframework.security.oauth</groupId> <artifactId>spring-security-oauth2</artifactId> <version>2.3.3.RELEASE</version> </dependency>
It seems it's not the problem of seata,but like dependency conflicts.
@xingfudeshi I am very appreciate it that you response it so quickly. But I try to exclusion spring-security-oauth2-autoconfigure
or spring-security-oauth2
can't solve this problem. it is normal when I don't apply seata.can you tell me which dependency I need to exclude?
thank you for your response again
I have the same question. Did you solved?
@xuande No, I have no idea at all... I am waiting for seata to solve
@xuande No, I have no idea at all... I am waiting for seata to solve add a Configuration class like this in your application.
import io.seata.rm.datasource.DataSourceProxy; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.security.oauth2.config.annotation.web.configuration.OAuth2ClientConfiguration;
/**
}
@xingfudeshi I tested it in a seata-samples and it didn't seem to change...Was I misconfigured?
Can you pull the latest code of seata,and install the 0.7.0-snapshot at local,then try it again?My testing was passed with it.We've optimized the priority of GlobalTransactionScanner in the 0.7.0,it will solve your problem.
SpringProxyUtils wants to get the Class of the proxy object, but if the scope of the class is web scope, spring cannot get the request, just call getTargetClass will be OK, hope it can help you.
modify the class io.seata.spring.util.SpringProxyUtils as following: `
public static Class<?> findTargetClass(Object proxy) throws Exception {
if (AopUtils.isAopProxy(proxy)) {
AdvisedSupport advised = getAdvisedSupport(proxy);
if (AopUtils.isJdkDynamicProxy(proxy)) {
TargetSource targetSource = advised.getTargetSource();
// remove
// return targetSource instanceof EmptyTargetSource ? getFirstInterfaceByAdvised(advised)
: targetSource.getTarget().getClass();
// add
return targetSource instanceof EmptyTargetSource ? getFirstInterfaceByAdvised(advised)
: targetSource.getTargetClass();
}
Object target = advised.getTargetSource().getTarget();
return findTargetClass(target);
} else {
return proxy == null ? null :proxy.getClass();
}
} `
Ⅰ. Issue Description
When I use the following dependencies and @EnableOAuth2Client
Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Ⅴ. Anything else we need to know?
Ⅵ. Environment: