Announcement Announcement Module
Collapse
No announcement yet.
Jar files needed for hibernate with spring? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jar files needed for hibernate with spring?

    I've been trying to get Spring to work with hibernate for a long time now and the one thing that is missing from every tutorial is what jar files are needed to actually make it work in real life.

    Hopefully someone can help.

    I'm currently using version 2.5.6
    and have the following jar files included in my Eclipse project:
    spring.jar
    spring-mvc.jar
    spring-hibernate3.jar
    hibernate3.jar

    When running it in Tomcat 5.5
    I get the following error:

    Code:
    SEVERE: Error loading WebappClassLoader
      delegate: false
      repositories:
        /WEB-INF/classes/
    ----------> Parent Classloader:
    org.apache.catalina.loader.StandardClassLoader@15c07d8
     org.springframework.web.servlet.DispatcherServlet
    java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
    On Tomcat 6 I get along list of repeating messages that seem to revolve around the following error :

    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/OLStore-servlet.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/HibernateException

  • #2
    spring-mvc.jar and spring-hibernate3.jar aren't part of spring 2.5.6 so start b y removing that one.

    Also have you actually looked at the stacktrace...

    Code:
    java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    Which means spring-webmvc.jar and spring-web.jar aren't present in the WEB-INF/lib directory.

    The other one is an indication that your hibernate.jar isn't present in the WEB-INF/lib directory.

    Your jars in the WEB-INF/lib should at least include.

    spring.jar
    spring-web.jar
    spring-webmvc.jar
    hibernate3.jar

    For spring that is it about it no other jars are needed due to the fact that you use the spring.jar. Also make sure that it is the spring.jar from the 2.5.6 version and not another version because that will screw up things.

    Comment


    • #3
      Thanks

      Thanks Marten.

      The problem is that the libraries were in the Referenced Libraries part of the project in Eclipse. I didn't realize that Eclipse didn't make these jars available to the web app. Apparently , you can't add the libraries to the web inf library in Eclipse directly. I had to copy them into the directory manually and then refresh the project.

      I guess the point I was missing was that a Spring web app needs the jars it uses at run time.

      Comment


      • #4
        That has NOTHING to do with the fact that it is a spring based web app, it is for EVERY web app...

        Comment


        • #5
          Yeah. It was an over site.

          Comment

          Working...
          X