Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC + Hibernate + BlazeDS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC + Hibernate + BlazeDS

    Hi,

    I've a little problem with injecting my session Factory into my Spring + BlazeDS + Hibernate project. I'm getting this error:


    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genBUS': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genDAO': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'baseSessionFactory' is defined

    But I have defined my baseSessionFactory bean in dao.xml as follows:

    Code:
    <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" />
    
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory" ref="baseSessionFactory"/>
        </bean>
    
        <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
            <property name="location" value="classpath:/resources/test.properties"/>
        </bean>
    
        <bean id="comboPooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${database.driverClass}"/>
            <property name="jdbcUrl" value="${database.url}"/>      
    
            <property name="properties">
                <props>
                    <prop key="user">${database.user}</prop>
                    <prop key="password">${database.password}</prop>
                </props>
            </property>
    
    
            <property name="maxPoolSize" value="50"/>
            <property name="initialPoolSize" value="3"/>
            <property name="minPoolSize" value="5"/>
            <property name="maxStatements" value="200"/>
            <property name="maxIdleTime" value="50000"/>
            <property name="acquireIncrement"  value="10"/>
            <property name="unreturnedConnectionTimeout" value="90"/>
            <property name="maxConnectionAge" value="120"/>
        </bean>
    
    
    
        <bean id="baseSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
            <property name="dataSource" ref="comboPooledDataSource"/>
            <property name="packagesToScan">
                <list>
                    <value>model</value>
                 </list>
            </property>
            <property name="cacheProvider" ref="ehCacheProvider"/>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop> 
                    <prop key="hibernate.max_fetch_depth">2</prop>
                    <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
                    <prop key="hibernate.cache.use_query_cache">true</prop>
                    <prop key="hibernate.cache.use_second_level_cache">true</prop>
                    <prop key="hibernate.dialect">${database.dialect}</prop>
                    <prop key="hibernate.show_sql">true</prop>
                    <prop key="hibernate.use_sql_comments">true</prop>
                    <prop key="hibernate.format_sql">false</prop>
                    <prop key="hibernate.generate_statistics">true</prop>
                    <prop key="current_session_context_class">thread</prop>
    
                </props>
            </property>
    
        </bean>
    
    
         <bean id="ehCacheProvider" class="org.hibernate.cache.EhCacheProvider"/>


    And here is my genDAO:

    Code:
    @Repository(value="genDAO")
    public class GenDAO extends BaseDAO{
    
        @Resource(name="baseSessionFactory")
        private SessionFactory sessionFactory;
    
    }
    And BaseDAO:

    Code:
    public class BaseDAO extends HibernateDaoSupport {
    
        @Autowired
        public void init(SessionFactory factory) {
            setSessionFactory(factory);
        }
    }

    I don't think that there can be any problems arising with BlazeDS integration, but I can provide you any details if needed. where am I doing wrong?!

    any suggestions?
Working...
X