Skip to content

[native-image] Scala Apache HttpClient LogConfigurationException #1009

@kronolynx

Description

@kronolynx

I'm getting this error

Exception in thread "main" org.apache.commons.logging.LogConfigurationException: java.lang.ClassNotFoundException: org.
apache.commons.logging.impl.LogFactoryImpl (Caused by java.lang.ClassNotFoundException: org.apache.commons.logging.impl
.LogFactoryImpl)                                                                                                       
        at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1158)                                   
        at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:960)                                            
        at java.security.AccessController.doPrivileged(AccessController.java:62)                                       
        at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:957)                                       
        at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:624)                                       
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:655)                                           
        at org.apache.http.conn.ssl.DefaultHostnameVerifier.<init>(DefaultHostnameVerifier.java:82)                    
        at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:966)
        at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:56)
        at example.Sample$.runSample(ScalaApacheHttpRestClient.scala:19)
        at example.ScalaApacheHttpRestClient$.main(ScalaApacheHttpRestClient.scala:51)
        at example.ScalaApacheHttpRestClient.main(ScalaApacheHttpRestClient.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl
        at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:51)
        at java.lang.ClassLoader.loadClass(Target_java_lang_ClassLoader.java:127)
        at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1020)
        ... 11 more

In issue #768 someone suggest to fix this error using:

{
    "name" : "org.apache.commons.logging.impl.Jdk14Logger",
    "allDeclaredConstructors" : true,
    "allPublicConstructors" : true,
    "allDeclaredMethods" : true,
    "allPublicMethods" : true
  }

I can't make it work on GraalVM 1.0.0-rc12 and I haven't found any other solution.

Steps to reproduce

https://github.com/kronolynx/scala-graal-apache-http

After cloning the project

$ sbt assembly
$ native-image --enable-url-protocols=http,https -H:ReflectionConfigurationFiles=reflect.json --no-server -jar target/scala-2.12/graal-http.jar 
$ ./graal-http

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions