我是靠谱客的博主 结实石头,这篇文章主要介绍com.sun.org.apache.xml.internal.security.utils does not exist问题的解决,现在分享给大家,希望可以做个参考。

方法一:

网上大神的回答:

自己写的程序是不建议用com.sun这个玩意儿的。。这东西属于“Deprecated and restricted API”。。

而且各种com.sun的包现在都有替代品。。

  如果是公司的老项目非用不可,可以用eclipse导入maven,properties-> Java Compiler -> Errors/Warnings -> Deprecated and restricted API ->
Forbidden reference -> "error" 改成 "warning"

   jdk5是可以用这个api的,jdk6之后就不能用了,只能用java,javax开头的api。(据说而已,莫当真)

方法二(我使用的并通过了):

删除

import com.sun.org.apache.xml.internal.security.utils.Base64;
添加(我使用的):
import org.apache.commons.codec.binary.Base64;

或者用java8 java.util.Base64也行

加密解密(替换):

Base64.encodeBase64String
Base64.decodeBase64
方法三(朋友说有用,我没用过)

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>utf-8</encoding>
<!-- added by com.sun.org.apache.xml.internal.security.utils.Base64;编译异常
将${java.home}/lib/rt.jar添加到maven的compiler里面 如果 JAVA_HOME 里面没有,将 jre 里面的 copy
过来 -->
<compilerArguments>
<verbose />
<bootclasspath>${JAVA_HOME}/jre/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>


最后

以上就是结实石头最近收集整理的关于com.sun.org.apache.xml.internal.security.utils does not exist问题的解决的全部内容,更多相关com.sun.org.apache.xml.internal.security.utils内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(161)

评论列表共有 0 条评论

立即
投稿
返回
顶部