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

  • GWT +Spring 3 + Hibernate integration problem

    Hi all
    i'm newbie from this forum please be patient if I post in a wrong session.
    I'm developing (or try ) a simple application that integrate gwt Spring and hibernate. Application is made up of a simple button and textbox, when user insert string in a textbox and push the button, Server save in a MySql DB the text. When apache tomcat deploy my application this is log file:

    Code:
    22-ott-2010 21.43.31 org.apache.catalina.core.StandardContext listenerStart
    GRAVE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate3.AnnotationSessionFactoryBean] for bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.AnnotationSessionFactoryBean
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    	at [... omitted, too long :D ...]
    Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate3.AnnotationSessionFactoryBean] for bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.AnnotationSessionFactoryBean
    	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1235)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:433)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
    	... 33 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.AnnotationSessionFactoryBean
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666)
    	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511)
    	at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
    	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1256)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1227)
    	... 39 more
    22-ott-2010 21.43.31 org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    This is my applicationContext.xml:

    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
     xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context"
     xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:task="http://www.springframework.org/schema/task"
     xsi:schemaLocation="
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">      
    
    <!--  <context:annotation-config/>-->
    
    	<!--  <bean id="ApplicationService" class="com.provamaven.app.applicazione.server.ApplicationServiceImpl" /> -->
    	<!-- Definizione file proprietÓ connessione db -->
       <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location" value="jdbc.properties" />
       </bean>
       
       <bean id="validationFactory" class="javax.validation.Validation" factory-method="buildDefaultValidatorFactory" />
    		    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    				<property name="sessionFactory">
    					<ref local="sessionFactory" />
    				</property>
       </bean>
       <context:annotation-config />
       <context:component-scan base-package="com.provamaven.app.applicazione.server.*" />
    
    
    	 <!-- DataSource -->
         <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
          <property name="driverClassName">
             <value>${database.driver}</value>
          </property>
          <property name="url">
             <value>${database.url}</value>
          </property>
         <property name="username">
             <value>${database.user}</value>
          </property>
          <property name="password">
             <value>${database.password}</value>
          </property>
       </bean>
    	
    	<!-- Session Factory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.AnnotationSessionFactoryBean">
          <property name="dataSource"><ref local="dataSource"/></property>
          <property name="annotatedClasses">
             <list>
                <value>com.provamaven.app.applicazione.client.Comment</value>
               </list>
          </property>
          <property name="hibernateProperties">
             <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>  
             </props>
          </property>
       </bean>
       
       <bean id="commentDao"  class="com.provamaven.app.applicazione.server.dao.CommentDAOHibernateImpl">
        <property name="sessionFactory" ref="sessionFactory" />
      </bean>
       
      
    	
    	<tx:annotation-driven />
    	<!--  Injection del sessyon factory nel Transaction manager -->
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      		<property name="sessionFactory" ref="sessionFactory"/>
      	</bean>
    	
    	
    </beans>
    Please help me I'm stucked
    Any help is appreciated. If some one has a link that explain how to integrate them please post it!
    Last edited by Anhell; Oct 23rd, 2010, 04:42 AM.
Working...
X