1 Reply Latest reply on Oct 2, 2007 4:32 AM by alesj

    sessionFactory annotations jboss spring-modules

    cclafuente

      I'm using springmodules annotations to the validation, and hibernate annotations to the persistent layer. With another application server, i haven't got any problem with my app, but in jboss it sends a exception, and don't deploy the war.

      My configuration
      in the dao layer:

      <!-- Hibernate SessionFactory -->
       <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
       <property name="dataSource" ref="dataSource"/>
       <property name="configurationClass">
       <value>org.hibernate.cfg.AnnotationConfiguration</value>
       </property>
       <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
       <property name="hibernateProperties">
       <value>
       hibernate.dialect=${hibernate.dialect}
       hibernate.query.substitutions=true 'Y', false 'N'
       </value>
       </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="sessionFactory"/>
       </bean>
      
       <bean id="abstractDao" abstract="true">
       <property name="sessionFactory" ref="sessionFactory"/>
       </bean>
      


      and the exception in jboss:
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jar:file:/C:/java/jboss-4.0.3SP1/server/default/tmp/deploy/tmp1447mamba-webapp-1.0-M1-SNAPSHOT-exp.war/WEB-INF/lib/mamba-core-1.0-M1-SNAPSHOT.jar!/applicationContext-dao.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener
      Caused by:
      java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener
       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:783)
      


      I don't want to use hibernate validation annotations, i'm using spring-moduleas annotations.
      What's the problem?
      As i explain in previously posts, in tomcat my webapp runs correctly, without errors, but in jboss it doesn't run.
      Thanks.