Leon
Leon
![QQ图片20210819104251](https://user-images.githubusercontent.com/62325709/129999177-0b5b0b6f-8af0-4db1-b2df-b8e0975dbaeb.png)
Because my github cannot send pictures, the error message is as follows: clean -> install org.bimserver.shared.exceptions.UserException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect at org.bimserver.shared.json.JsonReflector.callMethod(JsonReflector.java:120) at org.bimserver.generated.AuthInterfaceImplrQJiuMoqiyQS_1.login(AuthInterfaceImplrQJiuMoqiyQS_1.java)...
I am building from the parent class of maven. I now want to type it into a jar locally and run it. However, I have been failing to package through...
Thank you, I will give it a try
> 我用springboot的devtools热部署,也有遇到ClassCastException,但这并不是fastjson之类的bug,其他的库也会有这个错,ehcache也会遇到这个错。如果你也是用了devtools就有异常,不用就没异常,那具体可看spring官网的解决方案:https://docs.spring.io/spring-boot/docs/current/reference/html/using.html#using.devtools.restart.customizing-the-classload 目前我没有使用devtools,我只要是从redis读取进行强转,所有类都会提示这个异常 T t = (T)redisTemplate.opsForValue().get("key")
> @uhleon 使用`GenericFastJsonRedisSerializer`试试 see https://github.com/alibaba/fastjson2/blob/main/docs/spring_support_cn.md#41-generic-redis-serializer 我非常感谢您的回复,我使用了提供的两种方案去序列化redis ![image](https://user-images.githubusercontent.com/62325709/184291189-296d2966-cee4-48c3-934e-90ffc8aa6453.png) FastJsonRedisSerializer 提示的异常是和上述异常一致的,我复现了很多次,感觉好像是指定Object.class的问题 GenericFastJsonRedisSerializer 提示的异常为下述 ![image](https://user-images.githubusercontent.com/62325709/184291364-7798cfed-138e-474b-9cdc-ba73a9318f4b.png)
@VictorZeng 我已经自定义配置完白名单 ![image](https://user-images.githubusercontent.com/62325709/184311018-c88b0009-100d-4e89-872b-18d6fcbe89cc.png) 但是我如果使用 JSON.toJSONBytes(t, JSONWriter.Feature.WriteClassName); 去序列化Json到redis的时候,他已经是一个错误的JSON格式,并不能格式化 ![image](https://user-images.githubusercontent.com/62325709/184311333-09d17c19-e8f4-41ee-b24b-106203548e2c.png) 序列后的数据,您可尝试回显一下 {"@type":"org.springframework.security.oauth2.server.authorization.OAuth2Authorization","attributes":{"@type":"java.util.Collections$UnmodifiableMap","java.security.Principal":{"@type":"org.springframework.security.authentication.UsernamePasswordAuthenticationToken","authenticated":true,"authorities":[{"@type":"org.springframework.security.core.authority.SimpleGrantedAuthority","authority":"ROLE_admin"},{"@type":"org.springframework.security.core.authority.SimpleGrantedAuthority","authority":"ROLE_user"}],"details":{"@type":"org.springframework.security.web.authentication.WebAuthenticationDetails","remoteAddress":"127.0.0.1","sessionId":"29584A209FD143DB24C36708547E7A87"},"name":"leon","principal":{"@type":"com.uhbro.whale.dto.AuthUserDto","accountNonExpired":true,"accountNonLocked":true,"attributes":{"@type":"java.util.HashMap"},"authorities":Set[{"@type":"org.springframework.security.core.authority.SimpleGrantedAuthority","authority":"ROLE_admin"},{"@type":"org.springframework.security.core.authority.SimpleGrantedAuthority","authority":"ROLE_user"}],"credentialsNonExpired":true,"email":"[email protected]","enabled":true,"name":"leon","nickname":"leon","phone":"18137772224","userId":1,"username":"leon"}},"org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest":{"@type":"org.springframework.security.oauth2.core.endpoint.OAuth2AuthorizationRequest","additionalParameters":{"@type":"java.util.Collections$UnmodifiableMap"},"attributes":{"@type":"java.util.Collections$UnmodifiableMap"},"authorizationRequestUri":"http://127.0.0.1:9000/whale/oauth2/authorize?response_type=code&client_id=web&scope=all&redirect_uri=https://www.baidu.com","authorizationUri":"http://127.0.0.1:9000/whale/oauth2/authorize","clientId":"web","grantType":{"value":"authorization_code"},"redirectUri":"https://www.baidu.com","responseType":{"value":"code"},"scopes":Set["all"]},"state":"ITbg4w8iUSHwaFbRmFTu8es9CfFSAMQg6oZEq3fwH4Y="},"authorizationGrantType":{"value":"authorization_code"},"id":"29546756-a176-463c-8dd6-e4f675e20d8a","principalName":"leon","registeredClientId":"web"} 异常信息 ![image](https://user-images.githubusercontent.com/62325709/184311517-9132de96-cd9f-463b-bf19-85ee200f42af.png)
@VictorZeng 我尝试了您提供的方法,但是还是未能解决问题,现在我有一个疑问,当我配置redis的时候 如下 ![image](https://user-images.githubusercontent.com/62325709/184469121-0f4c9649-27cf-4742-928c-187509063935.png) 当我指定泛型为Object.class 就不可以反序列化Bean了 复现代码: ![image](https://user-images.githubusercontent.com/62325709/184469390-8e6357ec-f70e-48df-a685-dee4e1bb4dd0.png) ![image](https://user-images.githubusercontent.com/62325709/184469401-2bdd7b35-902c-4a27-9996-9443bc505dec.png) 异常信息: ![image](https://user-images.githubusercontent.com/62325709/184469409-2b2d7516-5db0-44d6-a844-a18920c78d87.png) 是我哪里方法用的有错误吗