Hi,

In order to use the same transaction manager (in SMX4) between my queue
manager (ActiveMq) and DB (MySQL accessed through Spring + Hibernate), I
have parametrized my Spring LocalSessionFactoryBean like this to retrieve
the JtaTransactionManager from the OSGI service exported from the bundle
"Apache ServiceMix Transaction (1.1.0.SNAPSHOT)" :

        <!--  Hibernate SessionFactory Definition -->
        <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        
                <property name="mappingLocations">
                    <list>
                          
<value>classpath*:META-INF/org/apache/camel/example/reportincident/model/*.hbm.xml</value>
                        </list>
                </property>
                 
                <property name="hibernateProperties">
                        <props>
                                <prop 
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                                <prop key="hibernate.show_sql">false</prop>
                                <prop key="hibernate.format_sql">true</prop>
                                <prop 
key="hibernate.cglib.use_reflection_optimizer">true</prop>
                                <prop key="hibernate.jdbc.batch_size">10</prop>
                                <!--  <prop
key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
 
-->
                        </props>
                </property>
                <property name="dataSource">
                        <ref bean="dataSource" />
                </property>
                <property name="jtaTransactionManager">
                        <osgi:reference 
interface="javax.transaction.TransactionManager"/>
                </property>
        </bean>

Unfortunately, when a transaction is initiated by Hibernate, I receive the
following error :

java.lang.StackOverflowError
        at java.lang.Thread.getContextClassLoader(Thread.java:1314)
        at 
com.sun.naming.internal.VersionHelper12$6.run(VersionHelper12.java:165)
        at java.security.AccessController.doPrivileged(Native Method)
        at
com.sun.naming.internal.VersionHelper12.getContextClassLoader(VersionHelper12.java:162)
        at
com.sun.naming.internal.ResourceManager.getFactory(ResourceManager.java:339)
        at javax.naming.spi.NamingManager.getURLObject(NamingManager.java:575)
        at javax.naming.spi.NamingManager.getURLContext(NamingManager.java:533)
        at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:320)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at
org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:162)
        at
org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)

It seems that Spring or Hibernate performs a JNDI lookup to find the
transaction manager

Question : 

Do I have to change my Spring / Hibernate config or is it a missing piece
(absence of JNDI feature) of SMX4 ?

Regards,

 




-----
Charles Moulliard
SOA Architect

My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: 
http://www.nabble.com/SMX4-Kernel---Transaction-Manager---JNDI---tp22719220p22719220.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to