aspose file tools*
The moose likes Spring and the fly likes exceptions in spring configuration file. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "exceptions in spring configuration file." Watch "exceptions in spring configuration file." New topic
Author

exceptions in spring configuration file.

indu iyengar
Ranch Hand

Joined: Jul 30, 2010
Posts: 115
Hi all ,
while integrating spring with hibernate, my spring configuration file is ::::

<?xml version="1.0" encoding="UTF-8"?>
<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">

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean>

<bean name="/login.htm" class="com.controllers.LoginController">
<property name="validator"><ref bean="loginValidator"/></property>
<property name="formView" value="LoginForm"></property>
<property name="successView" value="LoginSuccess"></property>
<property name="commandName" value="loginStudent"></property>
<property name="commandClass" value="com.bean.LoginStudent"></property>
<property name="sessionForm" value="true"></property>
</bean>

<bean id="loginValidator" class="com.validate.LoginValidator"></bean>

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages">
</property>
</bean>

<!-- ********************** DB (Hibernate) details ********************************* -->

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="password" value="admin"></property>
<property name="url" value="jdbc:mysql:///test"></property>
<property name="username" value="root"></property>
</bean>

<bean id="ex_hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>

<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"></ref></property>
<property name="hibernateProperties"><ref local="ex_hibernateProperties"></ref></property>
</bean>

</beans>

when running the following exception is coming ..


I need to provide again hibernateProperties.properties file again ?


thanks ,
Indu
Sujeeth Pakala
Ranch Hand

Joined: Mar 24, 2009
Posts: 94
Hello Indu,


You will have to mention the JDBC Connection details to hibernateProperties Bean definition, which will be used by LocalSessionFactoryBean.

Also, it depends on your type of transaction management you are trying to do!

Hope this helps.


Regards, Sujeeth Pakala
SCJP, SCWCD, SCBCD, ICAD, XML Master Basic, Certified SOA Professional
 
 
subject: exceptions in spring configuration file.