• Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassNotFound  RSS feed

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • 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 Java Windows XP
  • Mark post as helpful
  • send pies
  • 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
  • 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 Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the LoggerFactory package might be different . i.e, you have imported wrong class;
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!