Results 1 to 5 of 5

Thread: Jar files needed for hibernate with spring?

  1. #1
    Join Date
    Jun 2009
    Posts
    16

    Default 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2009
    Posts
    16

    Default 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.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    That has NOTHING to do with the fact that it is a spring based web app, it is for EVERY web app...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jun 2009
    Posts
    16

    Default

    Yeah. It was an over site.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •