|
From: Lars F. <lar...@gm...> - 2003-08-22 11:33:59
|
Still playing around with Spring and Hibernate ...
Data source works fine now, I just tested renaming the JNDI value to a wrong
name and I get
a very good error message.
Next step is to define something like
<bean id="exampleSessionFactory"
class="com.interface21.orm.hibernate.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>Employee.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop
key="hibernate.dialect">net.sf.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.query.substitutions">true=1 false=0</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="dataSource">
<ref bean="exampleDataSource"/>
</property>
</bean>
'Employee.hbm.xml' is located in /WEB-INF/classes in the war file and points
to the Employee
class with the appropriate package name (like in the webapp-hibernate
skeleton).
I've tested this outside of Spring and can insert a new Employee into the
database.
When inside the war with Spring I get the following error message:
21.08.2003 12.29 Uhr CEST> <Warning> <HTTP> <BEA-101162> <User defined
listener com.interface21.web.context.ContextLoaderListener failed:
com.interface21.context.ApplicationContextException: Cannot load configuration: problem
instantiating or initializing beans; nested exception is:
com.interface21.beans.FatalBeanException: No property
[mappingResources] in class [class com.interface21.orm.hibernate.LocalSessionFactoryBean].>
I don't think this is very useful because it doesn't tell you exactly what
is wrong (like using
a wrong data source name).
Could this be a classpath issue ? In my example app without spring the
*.hbm.xml is located
in the same directory as the class.
Thanks for your help
Lars
|