Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required in spring+hibernate
    primarykey
    data
    text
    <p>I am doing spring + hibernate apllication. When I run the application on tomcat server I am getting some exception. Below is my code.</p> <p>This is my bean config file.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"&gt; &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location"&gt; &lt;value&gt;WEB-INF/database/db.properties&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt; &lt;property name="url" value="${jdbc.url}" /&gt; &lt;property name="username" value="${jdbc.username}" /&gt; &lt;property name="password" value="${jdbc.password}" /&gt; &lt;/bean&gt; &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; &lt;property name="dataSource"&gt; &lt;ref bean="dataSource" /&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="mappingResources"&gt; &lt;list&gt; &lt;value&gt;Employee.hbm.xml&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="employeeBo" class="com.saggezza.employee.bo.impl.EmployeeBoImpl"&gt; &lt;property name="employeeDao" ref="employeeDao" /&gt; &lt;/bean&gt; &lt;bean id="employeeDao" class="com.saggezza.employee.dao.impl.EmployeeDaoImpl"&gt; &lt;constructor-arg ref="sessionFactory"&gt;&lt;/constructor-arg&gt; &lt;/bean&gt; </code></pre> <p>this is my dao class.</p> <pre><code>public class EmployeeDaoImpl extends HibernateDaoSupport implements EmployeeDao { private SessionFactory sessionFactory; public EmployeeDaoImpl(SessionFactory sessionfactory){ this.sessionFactory=sessionfactory; } @Override public List&lt;Employee&gt; getEmployeeDetails() { return getHibernateTemplate().find("from Employee"); } } </code></pre> <p>Here another class employeeBo is calling the employeeDaoImpl. when I run thisI am getting the below exception.</p> <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeBo' defined in ServletContext resource [/WEB-INF/spring/EmployeeBean.xml]: Cannot resolve reference to bean 'employeeDao' while setting bean property 'employeeDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeDao' defined in ServletContext resource [/WEB-INF/spring/EmployeeBean.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required </code></pre> <p>Can anybody help to resolve this. I have tried a lot and google it as well.But did get the solution.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload