找不到类GuardedString的异常



主要类别:


public static void main(String[] args) {
try {
String password = "Test";
System.out.println(password.toString());
char[] passwordToChar = password.toCharArray();
GuardedString guardString = new GuardedString(passwordToChar);
System.out.println(guardString.toString());
} catch (Exception exception) {
exception.printStackTrace();
}   
}
}

错误:

Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: org.identityconnectors.common.security.impl.EncryptorFactoryImpl
at org.identityconnectors.common.security.EncryptorFactory.getInstance(EncryptorFactory.java:45)
at org.identityconnectors.common.security.GuardedString.getEncryptor(GuardedString.java:250)
at org.identityconnectors.common.security.GuardedString.encryptBytes(GuardedString.java:265)
at org.identityconnectors.common.security.GuardedString.encryptChars(GuardedString.java:242)
at org.identityconnectors.common.security.GuardedString.<init>(GuardedString.java:91)
at org.identityconnectors.common.security.GuardedString.<init>(GuardedString.java:78)
at com.ad.createuser.TestCreateUser.main(TestCreateUser.java:31)
Caused by: java.lang.ClassNotFoundException: org.identityconnectors.common.security.impl.EncryptorFactoryImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.identityconnectors.common.security.EncryptorFactory.getInstance(EncryptorFactory.java:39)
... 6 more

依赖项:

<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-framework</artifactId>
<version>1.5.0.2</version>
</dependency>

我正在尝试使用";GuardedString";为了加密密码,我正在写测试代码,问题是";GuardedString";执行不当,我试图找到问题,但没有成功,可能是我做错了什么,不确定,让我知道解决方案,这很重要。

根据上面的注释,使用此依赖项可以实现

<dependency>
<groupId>net.tirasa.connid</groupId>
<artifactId>connector-framework-internal</artifactId>
<version>1.5.0.2</version>
</dependency>

我认为您的代码没有任何问题。我建议为您的项目重新加载maven依赖项。

相关内容

  • 没有找到相关文章

最新更新