1

I am new to Java and trying to develop a Java web application with a feature to browse the server's file system. The functionality works fine when I run the application in Eclipse but if I generate a WAR file (via "Export as WAR" in Eclipse) and deploy on Tomcat 7, it throws a NoClassDefFound error.

I have placed the required jar in the WEB-INB/lib folder and also noticed the jar is available after deployment.

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
umesh
  • 11
  • 1
  • 5
    WEB-INB/ or WEB-INF ? – Juned Ahsan Jun 05 '15 at 06:25
  • 1
    Hi, please post your full WAR layout first. Your application classes should reside in WEB-INF/classes. WEB-INF/lib is intended for libraries that are used by your classes. – shillner Jun 05 '15 at 06:27
  • I've had similar problems in past when packaging my app with war export on eclipse. I recommend you use for example Maven for this. Can you post the full stacktrace of your error? – exoddus Jun 05 '15 at 06:32
  • @shi There's no reason you have to use `WEB-INF/classes` for anything. You are free to put all your classes into a jar file that you include in `WEB-INF/lib`. – Kevin Panko Jun 05 '15 at 19:56

2 Answers2

0

first check your BuildPath. Your jars are added to build path are not.check with this link

Community
  • 1
  • 1
0

Without the Exception trace can't provide more details, but try the following:

  • Review the java.lang.NoClassDefFoundError error and identify the missing Java class.
  • Verify and locate the missing Java class from your compile / build environment. -Determine if the missing Java class is from your application code or third part API.
  • Go to Properties on your Project (right click) > Java Build Path > Order and Export. Check all needed librarys are included.

Hope this helps.

exoddus
  • 2,230
  • 17
  • 27