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.

Reply via email to