0

I am working on a web based project.

When I startup my tomcat server it redirects to an Login HTML page. On click of a login link a JSP Page is called. All the validation is done in the JSP page. Here Hibernate is used to interact with the database.

Problem:

On click of the login link, a ClassNotFoundException for the class MetadataProvider and ReflectionManager is thrown. Both the classes belong to the hibernate-annotations-common jar.

I have tried installing hibernate by updating my eclipse, by manually downloading the jar files and adding it to the web-inf/lib folder but still the same exception pops up.

Has it got anything to do with eclipse indigo 64 bit/windows 7 64 bit/tomcat 7? I found out previously that the eclipse is different for 32 bit and 64 bit. Is it the same for hibernate?


Added all the jars to the run configurations of the project and to my surprise it worked. I was of the opinion that the jars are pickup from the web-inf library. But I removed all the jars from there and added it on the run configurations and it works.

In the precious application I worked the jars were there in the web-inf lib folder and the run configurations had only the tomcat jars and it still worked. How was that possible?

jjnguy
  • 136,852
  • 53
  • 295
  • 323
Suri
  • 1
  • 2
  • try adding the jar file using Libraries -> Add Jar – Satya May 15 '12 at 10:13
  • Hey Satya, my library both web-inf and the reference library has the related jars, can you please elaborate? – Suri May 16 '12 at 17:22
  • can you please paste a pic of your project structure , and the stack trace of the error you are getting – Satya May 17 '12 at 00:04
  • Project | |-src | |-.java files -.cfg.xml |-lib |-WebContent | |-Web-Inf | |-lib Tried my best to explain the directory structure. – Suri May 17 '12 at 05:10
  • Here is the stack trace- SEVERE: Servlet.service() for servlet [jsp] in context with path [/Orgzr] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider] with root cause java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) – Suri May 17 '12 at 15:52
  • I also changed the eclipse version to Helios. Now i am getting another exception:SEVERE: Servlet.service() for servlet [jsp] in context with path [/Orgzr] threw exception [java.lang.ClassCastException: org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager] with root cause java.lang.ClassCastException: org.apache.catalina.core.DefaultInstanceManager cannot be cast to org.apache.tomcat.InstanceManager – Suri May 17 '12 at 15:53
  • let me try on my system and will let you know in an hr – Satya May 17 '12 at 18:51
  • Is it because of any conflict between the jars?? Should I include servlet-api,jsp-api and el-api jars?? – Suri May 18 '12 at 17:30
  • this time you need to add servlet-api,jsp-api and el-api jars – Satya May 18 '12 at 22:02
  • Still it is not working. Is there any compatibility issues between Hibernate -core jar and the hibernate-commons-annotations jar? I am using Hibernate-core-4.1.3 jar and Hibernate-commons-annotations-4.0.1 jar. Both final versions. – Suri May 20 '12 at 08:21
  • remove all jars , add them one by one , you will get to know where is the conflict – Satya May 20 '12 at 08:38

0 Answers0