Announcement Announcement Module
No announcement yet.
Could not instantiate class TransactionProxyFactoryBean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Could not instantiate class TransactionProxyFactoryBean

    Hi I am new to this forum. I was not sure if this was the correct place to put this thread but after carefully reading the contents of this section of the forum I found the fallowing,
    Thread How to use TransactionProxyFactoryBean in JavaConfig?
    is similar to my question's area. So please dont get mad if I submit in the wrong area.

    I generate web application using Struts, Spring and hibernate for a project. I am using godaddy to host it. I don't get any errors when i run the application in my local host but when I host it in the go daddy domain I get the fallowing error.

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SpringHibernateDao' defined in ServletContext resource [/WEB-INF/applicationContext-hibernate.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.transaction.interceptor.TransactionProxyFactoryBean]; constructor threw exception; nested exception is java.lang.NoClassDefFoundError: null
    	sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
    	java.lang.reflect.Method.invoke($ Method) Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    and this is what I have in my applicationContext-hibernate.xml

    	<!-- ========================= RESOURCE DEFINITIONS ========================= -->
    	<!-- 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>/WEB-INF/</value></property>
    	<!-- Local DataSource that works in any environment -->
    	<!-- Note that DriverManagerDataSource does not pool; it is not intended for production -->
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName"><value>${jdbc.driverClassName}</value></property>
    		<property name="url"><value>${jdbc.url}</value></property>
    		<property name="username"><value>${jdbc.username}</value></property>
    		<property name="password"><value>${jdbc.password}</value></property>
    	<!-- JNDI DataSource for J2EE environments -->
    	<!-- Hibernate SessionFactory -->
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="dataSource"/></property>
    		<property name="mappingResources">
    		<property name="hibernateProperties">
    				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
    				<prop key="hibernate.show_sql">true</prop>
    	<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	<!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->
    	 Data access object: Hibernate implementation.
    	<bean id="HibernateSpringDaoTarget" class="com.fitbook.dao.SpringHibernateDAOImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    		- Transactional proxy for Login Application central data access object.
    		- Defines specific transaction attributes with "readOnly" markers,
    		- which is an optimization that is particularly valuable with Hibernate
    		- (to suppress unnecessary flush attempts for read-only operations).
    		- Note that in a real-life app with multiple transaction proxies,
    		- you will probably want to use parent and child bean definitions
    		- as described in the manual, to reduce duplication.
    	<bean id="SpringHibernateDao" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager"><ref local="transactionManager"/></property>
    		<property name="target"><ref local="HibernateSpringDaoTarget"/></property>
    		<property name="transactionAttributes">
    				<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
    				<prop key="store*">PROPAGATION_REQUIRED</prop>
    	<!-- Email Service-->
    	<bean id="mailbean" class="com.fitbook.web.common.SendMail">
    		<property name="strSmtp"><value></value></property>
    It will be a great help if I could get any help or point me on any similar threads related to this error.

    Last edited by Anuradha Uduwage; Dec 4th, 2008, 10:07 AM.

  • #2
    Hi Anuradha,

    The preferred approach is not to use TransactionProxyFactoryBean at all. Take a look through the reference documentation at the sections on <tx:annotation-driven/> and @Transactional. This will point you in the right direction.

    As this isn't a question directly about the Spring JavaConfig project, I'm going to move this thread to the 'Core Container' forum.

    After you've read the appropriate documentation, if you still have questions feel free to post them. Remember also that the Spring sample projects cover transaction management in detail. You can take a look at Spring PetClinic, for example, to see how it's done there.


    • #3
      Thanks alot Chris, I will fallow the directions that you provided. But my biggest confusion is that not being able to reproduce in my development box using tomcat as the localhost.
      Last edited by Anuradha Uduwage; Dec 6th, 2008, 10:11 AM.