• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
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.

spring-config.xml
**************



ForumDAOImpl.java
*****************


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.

Cheers,
Yogesh
 
yogi reddy
Greenhorn
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.

http://mail-archives.apache.org/mod_mbox/tomcat-users/200310.mbox/%3C9C5166762F311146951505C6790A9CF83464C0@US-VS1.corp.mpi.com%3E

"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.

Thanks,
Yogesh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic