• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

ClassNotFound

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I am trying to upload a file and there is a class which is not found:

private Logger logger = LoggerFactory.getLogger(FileUploadController.class);


LoggerFactory, is not found the error inthe console is:

symbol : variable LoggerFactory
location: class bean.FileUploadController
private Logger logger = LoggerFactory.getLogger(FileUploadController.class);
^
1 error
¿Any clue?

Thanks
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you class path contains LoggerFactory.class ? i.e, do your path contains Jar file[*might be log4j jar*] which has LoggerFactory class. ?
 
Dura Hurtado
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I fix the error and add log4j jar import, this way : import org.apache.log4j.spi.LoggerFactory;

The next error appears:

symbol : method getLogger(java.lang.Class<bean.FileUploadController>)
location: interface org.apache.log4j.spi.LoggerFactory
private Logger logger = LoggerFactory.getLogger(FileUploadController.class);
^
1 error

¿Any clue?

Thanks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the LoggerFactory package might be different . i.e, you have imported wrong class;
 
Marshal
Posts: 22450
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Log4J's LoggerFactory is an interface, and has no static methods. I found another LoggerFactory, of SLF4J. This has the method you're calling. So remove the Log4J import and library, and replace it with the SLF4J library and import.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic