Announcement Announcement Module
Collapse
No announcement yet.
Need Help -- Validation Error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help -- Validation Error

    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&#58;//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 &#40;default implementation&#41;, 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&#58;//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"
    	- &#40;see web.xml's "contextConfigLocation"&#41;.
    	-
    	- 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&#58; It will run as-is in plain Tomcat.
    	-->
    <beans>
    
    	<!-- Configurer that replaces $&#123;...&#125; placeholders with values from a properties file -->
    	<!-- &#40;in this case, JDBC-related settings for the dataSource definition below&#41; -->
    	<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>$&#123;hibernate.connection.driver_class&#125;</value></property>
    		<property name="url"><value>$&#123;hibernate.connection.url&#125;</value></property>
    		<property name="username"><value>$&#123;hibernate.connection.username&#125;</value></property>
    		<property name="password"><value>$&#123;hibernate.connection.password&#125;</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 &#40;alternative to JTA&#41; -->
    	<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    
    	<!-- Transaction manager that delegates to JTA &#40;for a transactional JNDI DataSource&#41; -->
    	<!--
    	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
    	-->
    	
    	<!-- ========================= DAO DEFINITIONS&#58; 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>

  • #2
    Could some one please HELP?

    I've not yet resolved this error message.

    Thanks!

    Comment


    • #3
      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.
      More interesting in this context would be the actual implementation of the class com.apple.irmt.dao.hibernate.HibernateRequirementD ao.
      Is there a public setter named setDataSource?

      As of your problem with the "abstract" attribute I have no clue. Especially since the current plugin bases on Spring 1.0.2 which doesn't support the abstract attribute yet.

      Regards,
      Andreas

      Comment


      • #4
        No. My HibernateProjectDao doesn't have any "dataSource" setter method. It extends HibernateDaoSupport which doesn't have "dataSource" property either. That's why i'm getting this problem. But i got this config file from the petclinic sample!!!

        After i changed the "dataSource" to "sessionFactory"property in the HibernateProjectDao bean definition, the error vanished but i'm not sure that's the way to go.

        Thanks!

        Comment

        Working...
        X