Solved

ApplicationContext.xml...Can't find sessionFactory error??

Posted on 2007-03-25
3
433 Views
Last Modified: 2010-05-18
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
      <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
            <property name="url"><value>jdbc:mysql://localhost/myDB</value></property>
            <property name="username"><value>root</value></property>
            <property name="password"><value></value></property>
  </bean>  
      <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
            <property name="dataSource">
                  <ref bean="dataSource" />
            </property>
            <!-- XML Mapping files -->
            <property name="mappingResources">
                  <list>
            <value>Project.hbm.xml</value>
            <value>Employee.hbm.xml</value>
            <value>Tasks.hbm.xml</value>
               </list>
         </property>
         <property name="hibernateProperties">
          <props>
              <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
              <prop key="hibernate.show_sql">true</prop>
              <prop key="hibernate.format_sql">true</prop>
                           <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
          </props>
     </property>
      </bean>            
  <bean id="employeeDao" class="EmployeeDaoImp">
        <property name="sessionFactory" ref="sessionFactory"/>
  </bean>  
=============
I am using SPring Hibernate DAO and I am not sure how does this Dependency Injection work??

In my driver,
ClassPathResource classPathResource = new ClassPathResource("applicationContext.xml");
        XmlBeanFactory beanFactory = new XmlBeanFactory(classPathResource);
           
    ==>    EmployeeDaoImp employeeDao = (EmployeeDaoImp) beanFactory.getBean("employeeDao");

I get an error from here which says the sessionFactory class not be found when it gets referenced from EmployeeDao bean.

Wha does that mean??
can you help??

       
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 150 total points
ID: 18790608
You need to add it to your classpath I guess.

http://www.mindprod.com/jgloss/classpath.html
0
 
LVL 8

Accepted Solution

by:
mnrz earned 200 total points
ID: 18790768
if you are running this from Eclipse or any other IDE you should add the folder in which your applicationContext.xml exists to the classpath or in Eclipse as "class folder"
0
 
LVL 92

Assisted Solution

by:objects
objects earned 150 total points
ID: 18790995
check your log, I'd say something is failing during startup.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question