Getting Java.Lang.Classnotfoundexception: Org.Apache.Commons.Logging.Logfactory Exception

Error: NoClassDefFoundError: org/apache/commons/logging/LogFactory

please download the commons-logging jar file and set the path.

http://commons.apache.org/proper/commons-logging/download_logging.cgi

java.lang.ClassNotFoundException: org.apache.commons.logging.Log

As you ccn see in the root exception: Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log

You miss the commons-logging.jar in your classpath.

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

It seems "org/apache/commons/logging/LogFactory" is missed.
Have you imported the library?

How to fix 'org.apache.commons.logging.LogConfigurationException: java.lang.ClassNotFoundException' in quarkus native image

Problem Solved!

I did this configuration

In my pom.xml i put this configuration on native profile


<additionalBuildArgs>
<additionalBuildArg>
-H:ReflectionConfigurationFiles=${project.basedir}/reflection-config.json
</additionalBuildArg>
<additionalBuildArg>
-H:DynamicProxyConfigurationFiles=${project.basedir}/proxy-config.json
</additionalBuildArg>
<additionalBuildArg>
-H:ResourceConfigurationFiles=${project.basedir}/resource-config.json
</additionalBuildArg>
</additionalBuildArgs>

reflection-config.json


[
{
"name": "org.apache.commons.logging.impl.LogFactoryImpl",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.amazonaws.partitions.model.Partitions",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.partitions.model.Partition",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.partitions.model.Endpoint",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.partitions.model.Region",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.partitions.model.Service",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.partitions.model.CredentialScope",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "java.util.HashSet",
"allPublicMethods": true,
"allDeclaredConstructors": true
},
{
"name": "com.amazonaws.auth.AWS4Signer",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "java.lang.String",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "org.apache.commons.logging.LogFactory",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "org.apache.commons.logging.impl.SimpleLog",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
}
]

proxy-config.json


[
[
"org.apache.http.conn.HttpClientConnectionManager",
"org.apache.http.pool.ConnPoolControl",
"com.amazonaws.http.conn.Wrapped"
]
]

resource-config.json

{
"resources": [
{
"pattern": "com/amazonaws/partitions/endpoints.json"
}
]
}

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

Donwload commons-logging and place the jar(s) in WEB-INF/lib.

And for the future - google the class name that is not found to see which library it belongs to, download it and put it on the classpath (WEB-INF/lib in this case)



Related Topics



Leave a reply



Submit