• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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;
 
Sheriff
Posts: 22783
131
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.
reply
    Bookmark Topic Watch Topic
  • New Topic