1
I’m trying to use the following library: https://github.com/Samuel-Oliveira
To use it, it is necessary to upload a digital certificate, in the case of type A1.
When trying to use it with a normal class with a public static void main
works normally. I have a jar of my project that I use all the time.
It turns out that using the library in a web project <package>war</package>
and deploying in the Wildfly(versão 13)
, when trying to load the certificate: CertificadoService.certificadoPfx(path, pass);
bursts that Exception:
Caused by: java.lang.NoClassDefFoundError: sun/security/pkcs11/wrapper/PKCS11Exception
Follows 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);
}
}
}