camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sathis.g@gmail.com" <sathi...@gmail.com>
Subject Camel Guice and JNDi and Hibernate SessionFactory
Date Thu, 19 May 2016 19:49:42 GMT
Trying to integrate Camel Guice and JNDI. 

I have configured DataSource as provider binding in Guice Module. This
module is bootstrapped through jndi.properties file in classpath

@Provides
@JndiBind("jdbc/dbName")
@Singleton
public DataSource createDataSource() {
   //Actual code for creating DataSource
}

Another Provider Binding creates Hibernate SessionFactory

@Provides
@JndiBind("sessionfactory")
@Singleton
public SessionFactory createHibernateSessionFactory() {
  // Try to create Hibernate Session Factory by loading hibernate.cfg.xml.
Which uses the above created // DataSource 
}

The above Binding creates an Infinite Recursion in
GuiceInitialContextFactory in the method getInitialContext. i.e  when
SessionFactory is created it looks up DataSource using JNDI then again the
SessionFactory is being Initialized again which triggers again a call to
lookup DataSource  and this becomes recursive.

Any help here would be greatful




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Guice-and-JNDi-and-Hibernate-SessionFactory-tp5782794.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message