[
https://issues.apache.org/jira/browse/ARTEMIS-5340?focusedWorklogId=960519&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-960519
]
ASF GitHub Bot logged work on ARTEMIS-5340:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 06/Mar/25 11:52
Start Date: 06/Mar/25 11:52
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #5547:
URL: https://github.com/apache/activemq-artemis/pull/5547#discussion_r1983217987
##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/ssl/SSLSupport.java:
##########
@@ -352,10 +354,15 @@ public static KeyStore loadKeystore(final String
keystoreProvider,
return ks;
}
- public static void checkPemProviderLoaded(String keystoreType) {
+ /**
+ * This method uses reflection to load the appropriate
java.security.Provider for PEM use-cases. Reflection is used
+ * to avoid a hard dependency on the provider's implementation so that
folks who don't use PEM don't have to include
+ * the corresponding dependency.
+ */
+ public static void checkPemProviderLoaded(String keystoreType) throws
Exception {
if (keystoreType != null && keystoreType.startsWith("PEM")) {
if (Security.getProvider("PEM") == null) {
- Security.insertProviderAt(new
de.dentrassi.crypto.pem.PemKeyStoreProvider(),
+ Security.insertProviderAt((Provider)
Class.forName(PEM_PROVIDER).getDeclaredConstructor().newInstance(),
Review Comment:
You could instead just move the original line (with wrapped next part) into
a static method in its own sibling class, e.g PEMSupport.loadProvider() and
then call out to it. That should then just work as intended, even without using
reflection, because that class would not be initialized unless executing the
method and so the related classes/dependency would then also not be referenced.
Issue Time Tracking
-------------------
Worklog Id: (was: 960519)
Time Spent: 40m (was: 0.5h)
> PEM provider not actually optional
> ----------------------------------
>
> Key: ARTEMIS-5340
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5340
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Work was done via ARTEMIS-4710 to make the dependencies for the PEM security
> provider optional. However, that work was not complete.
> The provider class still has to be loaded by the JVM the first time any
> reference to {{SSLSupport}} is made which is done when enabling SSL on any
> acceptor, e.g.:
> {noformat}
> Caused by: java.lang.NoClassDefFoundError:
> de/dentrassi/crypto/pem/PemKeyStoreProvider
> at
> org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor.<init>(NettyAcceptor.java:294){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact