• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Spring 2.5 with Hibernate 3.0 error when creating dataSource for Hibernate SessionFactory

Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All - I am trying to integrate Spring 2.5 with Hibernate 3.0 and encountered an issue and sitting like a duck. Tried for more than 4 hours and exhausted now.

The standalone program with public static void main (which is not inside an applicaiton server) will read following spring-config.xml
and access the dao and execute a simple a select.



I encountered the following error

2531 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2750 [main] ERROR org.hibernate.LazyInitializationException - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session

Then I changed the spring-config.xml to create a data source using jndi (jdbc/myoracle) configured in Tomcat App server and
JndiObjectFactoryBean as follows... I also have a seprate hibernate.cfg.xml which contains database information.

Also I had tomcat server running when I was running the program.

Another Different Error this time

Error creating bean with name 'dataSource' defined in class path resource [spring-config.xml]:
Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name java:comp is not bound in this Context

Any thoughts or suggestions on how to fix this? Thanks in advance for your time.

yogi reddy
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I was analyzing this issue and it looks like this can not be done. Please find the snippet which I found some from some forum.


"if you tried the above, and had a tomcat server running, and had
the naming jar in your classpath (so your app does need to know about
tomcat, however implicitly, via classpath and class name above), it
STILL wouldn't work. That's because tomcat doesn't support external
JNDI calls."

Is this true? I do NOT try something which is not possible.

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic