jansohn commented on issue #502:
URL: https://github.com/apache/mina-sshd/issues/502#issuecomment-3199957475

   My (ugly) workaround for now which I execute during initialization phase of 
my web application:
   
   ```java
   if (Security.getProvider(SecurityUtils.BOUNCY_CASTLE) != null) {
       log.info("Removing already existing BouncyCastle provider due to 
possible classloader issues...");
       Security.removeProvider(SecurityUtils.BOUNCY_CASTLE);
   
       String registrarClass = 
BouncyCastleSecurityProviderRegistrar.class.getName();
       
       // code copied from SecurityUtils.register()
       SecurityProviderRegistrar r;
       try {
           r = ThreadUtils.createDefaultInstance(SecurityUtils.class, 
SecurityProviderRegistrar.class,
                   registrarClass);
       } catch (ReflectiveOperationException t) {
           Throwable e = ExceptionUtils.peelException(t);
           log.error("Failed ({}) to create default {} registrar instance: {}",
                   e.getClass().getSimpleName(), registrarClass, 
e.getMessage());
           if (e instanceof RuntimeException) {
               throw (RuntimeException) e;
           } else if (e instanceof Error) {
               throw (Error) e;
           } else {
               throw new IllegalStateException(e);
           }
       }
   
       SecurityUtils.registerSecurityProvider(r);
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to