Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » java.lang.NoClassDefFoundError commons-logging but is in the build path
java.lang.NoClassDefFoundError commons-logging but is in the build path [message #1839007] Thu, 11 March 2021 09:40 Go to next message
Eduardo Gutierrez is currently offline Eduardo GutierrezFriend
Messages: 34
Registered: December 2017
Hi i cant run a java application with this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.especialistajee.jhd.filmoteca.dao.FilePeliculaDAO.<clinit>(
    at org.especialistajee.jhd.filmoteca.dao.GestorDAO.getPeliculaDAO(
    at org.especialistajee.jhd.filmoteca.Main.agregarPelicula(
    at org.especialistajee.jhd.filmoteca.Main.mostrarMenu(
    at org.especialistajee.jhd.filmoteca.Main.main(
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
    at java.base/java.lang.ClassLoader.loadClass(
    ... 5 more

Im using Eclipse and i have this project setup:

enter image description here

I have googled and seek for answers, but all seems to be solved including common-loggings in classpath. Ans seems its done...

Some code i want to test:

  package org.especialistajee.jhd.filmoteca.dao;

//import org.apache.log4j.*;
import org.especialistajee.jhd.filmoteca.Messages;
//import java.lang.System.Logger;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

 * Implementacion del acceso a los datos de las peliculas almacenados en un fichero
 * en el disco.
 * @author malozano
public class FilePeliculaDAO  {
    private static Log logger = LogFactory.getLog(FilePeliculaDAO.class);
     * Agrega una pelicula a nuestro fichero de peliculas.
     * @param p Pelicula que se agregara. Se producira un error si la pelicula
     * ya existe en el fichero, o si el parametro es <code>null</code>.
    public void addPelicula(PeliculaTO p) {
        System.out.println("Agregando en el fichero la pelicula " + p.getTitulo() + " con id " + p.getId());
            //logger.debug("Agregando en el fichero la pelicula "+ p.getTitulo() + " con id " + p.getId());
            logger.error("Error  agregando : " );
    } ...more code

Any help would be apreciated
  • Attachment: k0KLV.png
    (Size: 241.63KB, Downloaded 21 times)
Re: java.lang.NoClassDefFoundError commons-logging but is in the build path [message #1839043 is a reply to message #1839007] Thu, 11 March 2021 16:53 Go to previous message
David M. Karr is currently offline David M. KarrFriend
Messages: 744
Registered: July 2009
Senior Member
Generally, using Maven (or perhaps Gradle) to manage your dependencies is more effective, as opposed to manually adding jars to the build path.

How are you running your application?
Previous Topic:Please share your experience of using Kotlin in Eclipse
Next Topic:Problem with Java ACM or JDK
Goto Forum:

Current Time: Thu Jan 20 09:13:36 GMT 2022

Powered by FUDForum. Page generated in 0.01359 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top