Announcement Announcement Module
No announcement yet.
Spring-Flex 1.5 + Hibernate JPA 2 + Glassfish JNDI Lookup problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring-Flex 1.5 + Hibernate JPA 2 + Glassfish JNDI Lookup problem

    Today I'm using Gilead do deal if serialization problem, so I decided to try the new spring-flex (1.5.0.M1).
    In my application uses Hibernate 3.5.1 has JPA provider and Glassfish v3 as container, transaction management uses JTA.

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <persistence-unit name="SeMAE_PU" transaction-type="JTA">
            <!-- class hidden -->
                <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
                <property name="hibernate.session_factory_name" value="hibernate/SessionFactory" />
                <property name="hibernate.connection.release_mode" value="auto" />
                <property name="hibernate.transaction.flush_before_completion"    value="true" />
                <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>            
    And I get the persistent unit by jndi-lookup
    <jee:jndi-lookup id="OracleEMF" jndi-name="persistence/Oracle_PU" />
    <jee:jndi-lookup id="sessionFactory" jndi-name="hibernate/SessionFactory" />
    The first time I've tried:
    Caused by: java.lang.IllegalArgumentException: 
    Could not retrieve the underlying Hibernate SessionFactory from the provided EntityManagerFactory
    reading api-docs I found the way to manually insert the session factory:
        <flex:config-processor ref="jndiJpaHibernateConfigProcessor" />
        <flex:remoting-service default-channels="mySecureAMF, myAMF" />
        <flex:secured authentication-manager="_authenticationManager" access-decision-manager="flexAccessDecisionManager">
            <flex:secured-channel channel="mySecureAMF" access="IS_AUTHENTICATED_FULLY" />
    <bean id="jndiJpaHibernateConfigProcessor" class="">
        <property name="sessionFactory" ref="sessionFactory" />
    After that, I got the same error again, to understand what is going on I checkout the source code of JpaHibernateConfigProcessor and, as far as I learned, to get the same error again my sessionFactory must be null.
    But I use the same code with gilead and works!
    I create another JpaHibernateConfigProcessor with minor changes, removing the the getEntityManagerFactory code, only works with sessionFactory, and change the error messages.

    But when I used my processor the same error happened YET AGAIN, so in conclusion I thought: Somehow the automatic post processor config is running, independent on the manually is set or not.

    Now I'm stuck in this problem, and returning to gilead. There is some workaround for this problem? Is it a bug or just misconfiguration from my part?

    Thanks for the help.

    P.S.: Sorry for the bad writing, english isn't my native language.