Q:

Play Framework HTTPS SSLEngineProvider override

I have followed the example as per:
https://www.playframework.com/documentation/2.4.x/ConfiguringHttps
However, when I connect to the server the following exception is thrown.
[error] - play.core.server.NettyServer$PlayPipelineFactory - cannot load SSL context
java.lang.ClassNotFoundException: mypackage.CustomSSLEngineProvider
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_51]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_51]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_51]
    at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:27) ~[play-server_2.11-2.4.2.jar:2.4.2]

My command:
./activator run -Dhttp.port=disabled -Dhttps.port=9443 -Dplay.server.https.engineProvider=mypackage.CustomSSLEngineProvider -Dhttps.keyStore=conf/keystore.jks -Dhttps.keyStorePassword=changeit -Djavax.net.ssl.trustStore=conf/truststore.jks -Djavax.net.ssl.trustStorePassword=changeit -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true

I've done a full build and the class is in the package. I can only assume that the classloader cannot see the class, possibly due to its scope?
Can anyone shed any light on this?
Thanks

A:

Found a fix/work around. Turns out if you are running the application with 'run' your java class cannot be found under the classloader.
PlayDependencyClassLoader does not find application code
So the workaround was to create a separate JAR which contained the CustomSSLProvider. Now it works.

