In my FIRST spring application, i've two spring config files.
applicationContext-hibernate.xml and dataAccess-local.xml
I'm using Eclipse/Spring IDE plugin/Spring/Hibernate combination. In my application, i've 3 DAO objects.
I'm getting the following validation error for dataAccess-local.xml
No setter for property 'dataSource' defined in class 'com.apple.irmt.dao.hibernate.HibernateRequirement Dao'
As you can see i've defined the property 'dataSource' which is referencing another bean in the same file. I'm getting the same error for all the DAO definitions.
Could someone please point out what's the problem???
Also, in applicationContext-hibernate.xml file, i'm getting the following error message:
Attribute "abstract" must be declared for element type "bean". applicationContext-hibernate.xml iRMT/test/META-INF line 11
Again, i've included the "abstract" attribute. I've no idea why this error messaging is coming.
I greatly appreciate any help on this problem.
Thanks!
Here's the applicationContext-hibernate.xml file
Code:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- - A parent bean definition which is a base definition for transaction proxies. - It's marked as abstract, since it's not supposed to be instantiated itself. - We set shared transaction attributes here, following our naming patterns. - The attributes can still be overridden in child bean definitions. --> <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true"> <property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributes"> <props> <prop key="insert*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean> <!-- - RMT primary business object (default implementation), as an inner bean wrapped - by an outer transactional proxy. The two bean definitions could have been separate, - but this is cleaner as there is no need to ever access the unwrapped object. --> <bean id="RMT" parent="baseTransactionProxy"> <property name="target"> <bean class="com.apple.irmt.domain.logic.iRMTImpl"> <property name="projectDao"><ref bean="projectDao"/></property> <property name="requirementDao"><ref bean="requirementDao"/></property> <property name="resourceDao"><ref bean="resourceDao"/></property> </bean> </property> </bean> </beans> Here's the dataAccess-local.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!-- - Application context definition for RMT's data access layer. - Accessed by business layer objects defined in "applicationContext.xml" - (see web.xml's "contextConfigLocation"). - - This version of the data access layer works on a combined database, - using a local DataSource with DataSourceTransactionManager. It does not - need any JTA support in the container: It will run as-is in plain Tomcat. --> <beans> <!-- Configurer that replaces ${...} placeholders with values from a properties file --> <!-- (in this case, JDBC-related settings for the dataSource definition below) --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"><value>src/META-INF/hibernate-rmt.properties</value></property> </bean> <!-- ========================= RESOURCE DEFINITIONS ========================= --> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>${hibernate.connection.driver_class}</value></property> <property name="url"><value>${hibernate.connection.url}</value></property> <property name="username"><value>${hibernate.connection.username}</value></property> <property name="password"><value>${hibernate.connection.password}</value></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="dataSource"><ref local="dataSource"/></property> <property name="mappingLocations"> <value> /META-INF/**/*.hbm.xml </value> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop> </props> </property> </bean> <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --> <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"><ref local="sessionFactory"/></property> </bean> <!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) --> <!-- <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/> --> <!-- ========================= DAO DEFINITIONS: Hibernate IMPLEMENTATIONS ========================= --> <bean id="requirementDao" class="com.apple.irmt.dao.hibernate.HibernateRequirementDao"> <property name="dataSource"><ref local="dataSource"/></property> </bean> <bean id="projectDao" class="com.apple.irmt.dao.hibernate.HibernateProjectDao"> <property name="dataSource"><ref local="dataSource"/></property> </bean> <bean id="ResourceDao" class="com.apple.irmt.dao.hibernate.HibernateResourceDao"> <property name="dataSource"><ref local="dataSource"/></property> </bean> </beans>


Reply With Quote