Search code examples
javadependenciesapache-commons-logging

Error running Java EE application with GlassFish: NoClassDefFoundError: org/apache/commons/logging/LogFactory


When trying to run a Java EE application with GlassFish, I encounter the following error on the server:

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.apache.http.conn.ssl.DefaultHostnameVerifier.<init>(DefaultHostnameVerifier.java:72)
    ...
...
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at dynamics365.TokenGenerator.ejecutarTokenGenerator(TokenGenerator.java:62)
    at sessionBeans.ParametroFacade.buscarCliente(ParametroFacade.java:103)
        at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808)
    ...

What I've tried:

  • I have reviewed the project configuration to make sure all dependencies are configured correctly.
  • I have removed the use of Apache Commons Logging as it appears to be the cause of the problem.
  • I have cleaned and rebuilt the project to make sure there are no outdated build artifacts.
  • I've reviewed the project structure and GlassFish server configuration to ensure everything is in order.

Wait:

I am looking for help to fix this error and understand why it occurs. Is there something I'm overlooking in my configuration or dependency management? How can I resolve this issue and run my application without this error?


Solution

  • What I did was reload all the JAR into the lib of the payara domains, restart it and from there, clean and build the project and it worked.