Failed load org.apache.commons.logging.impl.LogFactoryImpl

Hi all,

Sorry guys, I’m out of luck and looking for some help here.
I already placed all the required jar files under lib folder

and this is my code ( ya, just few lines ) Any ideas ?

Best Regards,

public void viewDidLoad(){
           HttpClient httpclient = HttpClients.createDefault();

and this is how my build.gradle look like, basically just the default setting :

buildscript {
repositories {
dependencies {
// Multi-OS Engine plugin
classpath group: ‘org.multi-os-engine’, name: ‘moe-gradle’, version: ‘1.3.+’

// Apply plugins
apply plugin: ‘eclipse’
apply plugin: ‘moe’

// Set source and target to Java 8
sourceCompatibility = “1.8”
targetCompatibility = “1.8”

// Set maven repository
repositories {

// Exclude all files from Gradle’s test runner
test { exclude ‘**’ }

// Setup Multi-OS Engine
moe {
xcode {
project ‘xcode/test-apache-httpclient.xcodeproj’
mainTarget ‘test-apache-httpclient’
testTarget ‘test-apache-httpclient-Test’

    // Uncomment and change these settings if you are working with a Xcode workspace
    // workspace 'xcode/test-apache-httpclient.xcworkspace'
    // mainScheme 'test-apache-httpclient'
    // testScheme 'test-apache-httpclient-Test'


dependencies {
// Compile with ‘jar’ files in the project’s ‘lib’ directory
compile fileTree(dir: ‘lib’, include: ‘*.jar’)

// Setup Eclipse
eclipse {
// Set Multi-OS Engine nature
project {
natures ‘org.multi-os-engine.project’


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(
at org.apache.commons.logging.LogFactory$
at org.apache.commons.logging.LogFactory.newFactory(
at org.apache.commons.logging.LogFactory.getFactory(
at org.apache.commons.logging.LogFactory.getLog(
at org.apache.http.impl.client.CloseableHttpClient.(
at org.apache.http.impl.client.AbstractHttpClient.(
at org.apache.http.impl.client.DefaultHttpClient.(
at com.xyprox.test.httpclient.ui.AppViewController.viewDidLoad(
at ap
ple.uikit.c.UIKit.UIApplicationMain(Native Method)
at com.xyprox.test.httpclient.Main.main(
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(
at java.lang.BootClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at org.apache.commons.logging.LogFactory.createFactory(
… 11 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/impl/LogFactoryImpl;
… 16 more


Total time: 14.089 secs

This build could be faster, please consider using the Gradle Daemon:

I’ve had this as well (but with org.apache.httpcomponents:httpclient:4.5.2). Some things I did to get around this:

In ios/proguard.append.cfg, add:

# Apache HTTP
-keep class org.apache.http.** { *; }
-keep interface org.apache.http.** { *; }
-keep class * extends org.apache.commons.logging.LogFactory { *; }
-keep class org.apache.commons.logging.impl.NoOpLog { *; }
-keep class org.apache.commons.logging.impl.ServletContextCleaner { *; }
-keep interface javax.servlet.ServletContextListener { *; }
-keep class javax.servlet.ServletContextEvent { *; }

In the AppDelegate or Main, turn off logging:
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");

In ios/build.gradle, add servlet dependency (since Apache assumes it’s already there, but it’s not):

dependencies {
    compile 'javax.servlet:servlet-api:2.3'
1 Like

Great!! I will give it a try! Thanks again! Thank you so much!