Announcement Announcement Module
Collapse
No announcement yet.
JPA do not work in spring flex when using JBossAS 5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JPA do not work in spring flex when using JBossAS 5

    Hi, guys
    I have a problem when try to use spring flex in JBossAS 5.1, could you guys kindly help.
    My environment is :
    JBossAS 5.1.0 GA
    <dependency>
    <groupId>org.springframework.flex</groupId>
    <artifactId>spring-flex-core</artifactId>
    <version>1.5.2.RELEASE</version>
    </dependency>
    Other spring dependency 3.1.1.RELEASE

    JPA persistence.xml

    <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
    <persistence-unit name="mockUnit" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence </provider>
    <jta-data-source>java:/H2DS</jta-data-source>
    <properties>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.hbm2ddl.auto" value="update"/>
    <property name="jboss.entity.manager.jndi.name" value="java:/mockUnitManager"/>
    <property name="jboss.entity.manager.factory.jndi.name" value="java:/mockUnitManagerFactory"/>
    </properties>
    </persistence-unit>
    </persistence>

    related spring ApplicationContext config is below:
    <jee:jndi-lookup id="entityManager" jndi-name="java:/mockUnitManager"/>
    <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:/mockUnitManagerFactory"/>
    <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTran sactionManager"/>
    <tx:annotation-driven transaction-manager="transactionManager"/>

    <bean id="defaultMessageTemplate" class="org.springframework.flex.messaging.MessageT emplate"/>

    <flex:message-broker>
    <flex:message-service default-channels="my-amf, my-polling-amf"/>
    </flex:message-broker>

    <flex:message-destination id="dataPushDestination"/>


    The Exception log is :

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '_messageBroker': Cannot resolve reference to bean 'org.springframework.flex.core.io.JpaHibernateConf igProcessor#0' while setting bean property 'configProcessors' with key [3]; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.flex.core.io.JpaHibernateConf igProcessor#0': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Could not retrieve the underlying Hibernate SessionFactory from the provided EntityManagerFactory
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:328)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:106)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveManagedSet(BeanDefiniti onValueResolver.java:365)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:157)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1360)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.flex.messaging.MessageTemplate .afterPropertiesSet(MessageTemplate.java:77)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1452)
    ... 128 more
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.flex.core.io.JpaHibernateConf igProcessor#0': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Could not retrieve the underlying Hibernate SessionFactory from the provided EntityManagerFactory
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1455)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 94)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:225)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:291 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:322)
    ... 142 more
    Caused by: java.lang.IllegalArgumentException: Could not retrieve the underlying Hibernate SessionFactory from the provided EntityManagerFactory
    at org.springframework.util.Assert.notNull(Assert.jav a:112)
    at org.springframework.flex.core.io.JpaHibernateConfi gProcessor.setEntityManagerFactory(JpaHibernateCon figProcessor.java:60)
    at org.springframework.flex.core.io.JpaHibernateConfi gProcessor.afterPropertiesSet(JpaHibernateConfigPr ocessor.java:46)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1452)
    ... 149 more

    this is the debug info I think maybe helpful:
    Attachment
    Attached Files
Working...
X