Skip to content
Advertisement

Tomcat. ClassNotFoundException on importing class

I am writing my training project on Tomcat based java servlets and jsp’s using Visual Studio Code. Now I am working on logging. My project structure looks like this:

JavaScript

Class AccessFilter.java realizes logging system. Here is code of AccessFilter.java:

JavaScript

Code of Log.java: package FamilyTask.lib;

JavaScript

Command for compile servlet/filter classes:

JavaScript

Command for compile simple classes:

JavaScript

Compilation ends without errors, but on run time I’m getting this error:

JavaScript

Advertisement

Answer

I solved this problem. The reason is that from previous compilation left log.class file (first letter is exactly lowercase letter, not Log.class). On prev compilation log class name started from lowercase letter. On next compilations with uppercase letter names the file system replaced old log.class file with the same name file. Deleting old .class file solved the problem.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement