Announcement Announcement Module
Collapse
No announcement yet.
Could not instantiate class TransactionProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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.


    Code:
    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
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:370)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
    	org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
    	org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
    	org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
    	javax.servlet.GenericServlet.init(GenericServlet.java:211)
    	sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:585)
    	org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)
    	java.security.AccessController.doPrivileged(Native Method)
    	javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    	org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266)
    	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
    	org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:110)
    	java.security.AccessController.doPrivileged(Native Method)
    	org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:617)
    	org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:431)
    	org.apache.catalina.startup.HostConfig.start(HostConfig.java:968)
    	org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
    	org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    	org.apache.catalina.startup.Catalina.start(Catalina.java:556)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:585)
    	org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
    	org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)
    and this is what I have in my applicationContext-hibernate.xml

    Code:
    <beans>
    
    	<!-- ========================= 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/jdbc.properties</value></property>
    	</bean>
    
    	<!-- 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>
    
    	</bean>
    	
    
    	<!-- 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">
    		<list>
    			<value>com/fitbook/dao/hibernate/Login.hbm.xml</value>
    		</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
    				<prop key="hibernate.show_sql">true</prop>
    			</props>
    		</property>
    	</bean>
    
    
    	<!-- 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>
    	</bean>
    
    
    	<!-- ========================= BUSINESS OBJECT DEFINITIONS ========================= -->
    
    	<!--
    	 Data access object: Hibernate implementation.
        -->
    
    	<bean id="HibernateSpringDaoTarget" class="com.fitbook.dao.SpringHibernateDAOImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
    
    	<!--
    		- 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">
    			<props>
    				<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>
    			</props>
    		</property>
    	</bean>
    
    	<!-- Email Service-->
    	<bean id="mailbean" class="com.fitbook.web.common.SendMail">
    		<property name="strSmtp"><value>192.168.10.14</value></property>
    	</bean>
    
    </beans>
    It will be a great help if I could get any help or point me on any similar threads related to this error.

    Thanks,
    Anuradha
    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.

    Comment


    • #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.

      Comment

      Working...
      X