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

gateway作为sso-client集成报错 #663

Open
kiwi-field opened this issue Aug 6, 2024 · 0 comments
Open

gateway作为sso-client集成报错 #663

kiwi-field opened this issue Aug 6, 2024 · 0 comments

Comments

@kiwi-field
Copy link

使用版本:

1.38.0

pom文件如下:

   <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-reactor-spring-boot-starter</artifactId>
        <version>1.38.0</version>
    </dependency>
    <!-- Sa-Token 插件:整合SSO -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-sso</artifactId>
        <version>1.38.0</version>
    </dependency>

    <!-- Sa-Token 整合redis (使用jackson序列化方式) -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-redis-jackson</artifactId>
        <version>1.38.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-pool2</artifactId>
    </dependency>

    <!-- Sa-Token插件:权限缓存与业务缓存分离 -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-alone-redis</artifactId>
        <version>1.38.0</version>
    </dependency>
    <!-- Http请求工具 -->
    <dependency>
        <groupId>com.dtflys.forest</groupId>
        <artifactId>forest-spring-boot-starter</artifactId>
        <version>1.5.26</version>
    </dependency>

调用代码如下:
image

报错信息:

cn.dev33.satoken.exception.SaTokenContextException: 未能获取有效的上下文
at cn.dev33.satoken.context.SaTokenContextForThreadLocalStorage.getBoxNotNull(SaTokenContextForThreadLocalStorage.java:72) ~[sa-token-core-1.38.0.jar!/:na]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
*__checkpoint ⇢ springfox.boot.starter.autoconfigure.SwaggerUiWebFluxConfiguration$CustomWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ cn.dev33.satoken.reactor.filter.SaPathCheckFilterForReactor [DefaultWebFilterChain]
*__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
*__checkpoint ⇢ HTTP POST "/api/app/di-studio/group/detail" [ExceptionHandlingWebHandler]
Original Stack Trace:
at cn.dev33.satoken.context.SaTokenContextForThreadLocalStorage.getBoxNotNull(SaTokenContextForThreadLocalStorage.java:72) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.context.SaTokenContextForThreadLocalStorage.getStorage(SaTokenContextForThreadLocalStorage.java:101) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.context.SaTokenContextForThreadLocal.getStorage(SaTokenContextForThreadLocal.java:49) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.context.SaHolder.getStorage(SaHolder.java:69) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.stp.StpLogic.isSwitch(StpLogic.java:2595) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.stp.StpLogic.getLoginIdDefaultNull(StpLogic.java:1012) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.stp.StpLogic.isLogin(StpLogic.java:905) ~[sa-token-core-1.38.0.jar!/:na]
at cn.dev33.satoken.stp.StpUtil.isLogin(StpUtil.java:315) ~[sa-token-core-1.38.0.jar!/:na]

希望结果:

复现步骤:

< 备注:如果复现步骤比较复杂,请将 demo 上传到 gitee 并留下地址 >

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

1 participant