I'm trying to use the following library: link
To use it, it is necessary to load a digital certificate, in this case, type A1.
When you try to use it with a normal class with a public static void main
it works normally. I have a jar of my design that I use all the time.
It turns out that by using the library in a web project <package>war</package>
and deploying in Wildfly(versão 13)
, when trying to load the certificate: CertificadoService.certificadoPfx(path, pass);
Bursts this Exception:
Caused by: java.lang.NoClassDefFoundError: sun/security/pkcs11/wrapper/PKCS11Exception
Follow class:
@Singleton
public class Worker {
private AtomicBoolean busy = new AtomicBoolean(false);
public void work() {
if (!busy.compareAndSet(false, true)) {
return;
}
try {
System.out.println("Executing this task at " + new SimpleDateFormat("HH:mm:ss").format(new Date()) + ".");
String path = "/home/user/certificado.pfx";
String pass = "4321";
CertificadoService.certificadoPfx(path, pass);
} catch (Exception e) {
e.printStackTrace();
} finally {
busy.set(false);
}
}
}