0

I'm getting the following errors:

javax.servlet.ServletException: Error instantiating servlet class auth.Login

and

java.lang.NoClassDefFoundError: javax/persistence/Persistence

How do I ensure my project's configuration is properly setup?

To me, this look correct.

enter image description here

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
KristianB
  • 1,403
  • 3
  • 25
  • 46

2 Answers2

1

I assume that java.lang.NoClassDefFoundError: javax/persistence/Persistence is the root cause of the servlet instantiation error, so we can just ignore the servlet instantiation error for now. A NoClassDefFoundError means that the class mentioned in the message was present in the webapp's compile time classpath, but not in the webapp's runtime classpath.

Those JARs which you have there in /lib folder should actually go in /WEB-INF/lib. This is part of the webapp's runtime classpath. Further you should also remove those three jsp* and servlet* JAR files. They do not belong in the webapp library. They belong in the servletcontainer library. If you did this to fix compile errors, it has to be fixed differently.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I found out that EclipseLink library somehow was missing from the Build Path and Deployment Assembly... That was the root of these errors. – KristianB May 03 '11 at 07:37
-1

I think runtime classpath does not have servlet-api.jar and that is causing java.lang.NoClassDefFoundError: javax/persistence/Persistence

Secondly as said earlier your libraries should be under WEB-INF/lib folder to fix the errors

GustyWind
  • 3,026
  • 3
  • 41
  • 50