Announcement Announcement Module
Collapse
No announcement yet.
hibernate and spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • hibernate and spring

    Hello,

    I am trying to add hibernate to my existing spring application.I am using spring 2.5,hibernate annotations 3.2, mysql and tomcat
    I have written applicationcontext.xml and hibernate.cfg.xml.
    But I am getting this error

    Context initialization failed.org.springframework.beans.factory.beandefinitions toreexception: IOException parsing XML document from servletcontext resource [/web-inf/applicationcontext.xml]
    nested exception is java.io.FilenotfoudException: could not open servletcontext resource [/web-inf/applicationContext.xml]


    Below are the two config files

    applicationContext.xml
    ****************************

    <?xml version="1.0" encoding="UTF-8"?>
    <beans >

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName">
    <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:mysql://localhost:3306/bank</value>
    </property>
    <property name="username">
    <value>root</value>
    </property>
    <property name="password">
    <value>root</value>
    </property>
    </bean>

    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.
    LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="configLocation">
    <value>WEB-INF\classes\hibernate.cfg.xml</value>
    </property>
    <property name="configurationClass">
    <value>org.hibernate.cfg.AnnotationConfiguration </value>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.hbm2ddl.auto">create</prop>
    </props>
    </property>
    </bean>
    <bean id="customerDAOimpl">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>

    <bean id="customerDAO" class="com.palnar.college.DAO.customerDAOHibernate Impl.java"
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>


    </beans>

    hibernate.cfg.xml

    ************************

    <hibernate-configuration>
    <session-factory>
    <mapping package="com.palnar.college.service" />
    <mapping class="com.palnar.college.service.Customer" />
    </session-factory>
    </hibernate-configuration>

    web.xml
    *************
    ......
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>

    ......

    PLEASE HELP ME OUT.THIS IS VERY URGENT

  • #2
    You have posted this in the forum category for the "Spring Integration" project.

    You should post in the "data access" forum.

    Thanks,
    -Mark

    Comment


    • #3
      Originally posted by lekshmi.giridhar View Post
      PLEASE HELP ME OUT.THIS IS VERY URGENT
      May I suggest that you purchase a SpringSource Platinum Support contract?

      Comment

      Working...
      X