您现在的位置是: 首页 > 后端开发 类 BASE64Decoder 程序包 sun.misc 找不到符号
类 BASE64Decoder 程序包 sun.misc 找不到符号
2020-05-29 【后端开发】 5462人已围观 9298次浏览
简介类 BASE64Decoder 程序包 sun.misc 找不到符号
在修改一个老项目的时候,打包出现提示
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project : Compilation failure
[ERROR] FileUtil.java:[7,16] 找不到符号
[ERROR] 符号: 类 BASE64Decoder
[ERROR] 位置: 程序包 sun.misc
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
根据提示查看文件发现,在 Base64 转换的地方使用的是 Sun 的专用 API
import sun.misc.BASE64Decoder;
BASE64Decoder decoder = new BASE64Decoder();
byte[] b = decoder.decodeBuffer(base64);
其实这个 API 在很早之前,打包的时候就会提示
sun.misc.BASE64Encoder 是 Sun 的专用 API,可能会在未来版本中删除
解决方案就是引用 Apache Commons Codec
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.14</version>
</dependency>
然后修改代码为
import org.apache.commons.codec.binary.Base64;
byte[] b = Base64.decodeBase64(base64);
重新打包则问题解决
很赞哦! (0)
相关文章
- SpringBoot 启动测试时出现提示 Test class should have exactly one public zero-argument constructor
- Nestedset 出现 Node must exists. 错误解决方案
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- start.spring.io访问太慢,构建SpringBoot项目失败
- SpringBoot 2.x Security security.basic.enabled=false 失效问题解决
- PHP 中list()出现Undefined offset: 0错误
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SqlServer 优化技巧
- PHP 在执行 composer install 时出现提示 PHP Fatal error: Allowed memory size of XXXXXX bytes exhausted <...>
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- Debian apt 使用国内镜像
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- nuxt 项目完整部署方案
- gulp3 在 node12 上运行出现异常 primordials is not defined
站长推荐
猜你喜欢
- SpringBoot 启动提示 Requested bean is currently in creation: Is there an unresolvable circular reference?
- Nestedset 出现 Node must exists. 错误解决方案
- ThinkPHP 解决跨域访问问题
- Docker 批量操作命令
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- 在更新python时出现dyld: Library not loaded: /usr/local/opt/libpsl/lib/libpsl.5.dylib,Reason: image not found错误解决方案
- LNMP 手动更新 SSL 证书
- 【代码片段】MySQL 查看数据库所有表注释
- layUI点击按钮页面刷新问题解决方案
- 解决Mac突然没声音的问题