GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — BouncyCastleAlpnSslUtils static initializer fails when using a Security Properties file · Issue #15508 · netty/netty Closed Milestone DescriptionWhen using a Security Properties file to configure the SecurityProviders, the System classloader is used to load the SecurityProviders. This leads to problems when using BouncyCastleAlpnSslUtils, leading to the "Unable to initialize BouncyCastleAlpnSslUtils." error, with the stack trace being (on version 4.1.122.Final): The problem starts with lines 63 - 64, with the call to Class.forName(), which uses the classloader of the caller, which is generally the ApplicationClassLoader. bcSslEngine = Class.forName("org.bouncycastle.jsse.BCSSLEngine"); final Class testBCSslEngine = bcSslEngine; However, a bit farther down, on lines 79 - 80, an SSLContext and SSLEngine are created, and since these are created from the Provider that was loaded by the SystemClassLoader, they themselves are loaded by the SystemClassLoader. SSLContext context = getSSLContext("BCJSSE"); SSLEngine engine = context.createSSLEngine(); Then when the attempt is made to invoke the getMethod call on line 89, the engine instance (in my case a final Object bcSslParameters = getParameters.invoke(engine); I believe that this can be fixed by applying the pattern seen in a number of other places in the repo, of enhancing the call to Class.forName() to pass in the class loader to use, instead of the one of the caller. I prototyped this locally by copying the code out of the static initializer, and creating the engine first before calling: SSLContext context = getSSLContext("BCJSSE"); SSLEngine engine = context.createSSLEngine(); bcSslEngine = Class.forName("org.bouncycastle.jsse.BCSSLEngine", true, engine.getClass().getClassloader()); getParameters = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() { @Override public Method run() throws Exception { return testBCSslEngine.getMethod("getParameters"); } }); final Object bcSslParameters = getParameters.invoke(engine); Then the I imagine the same pattern would need to be applied to any number of other Reacted by llh4github Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |