• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Doubt on hibernate

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,

I am newbie for hibernate.I have created a simple Java application Using hibernate .I have kept my hibernate.cfg.xml in my src folder.
but its not recognized .i got this error

Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found.

Please help me to get out from this so i can lot of new things in hibernate.

Thanks in advance.
 
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Beside the fact that you posted in the wrong forum: your hibernate.cfg.xml must be in the classpath. E.g. put it into the WEB_INF/classes folder. Or search this forum for other possibilities (this question was raised several times here already).
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should be in the ORM forum, as it has nothing to do with Struts.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(OT) How would that help?
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Greenhorn! Welcome to the ORM forum!

Well, I think what the poster might be getting at is that the hibernate-config.xml file isn't any good in the source folder at runtime. At runtime, the files are pulled from the classes direcotory, or wherever compiled code is placed. Often, Java code gets compiled and put into a build/bin/classes directory, but xml files don't always make the move. Sometimes a manual move out of the source directory and into the bin\classes\compile\build directory allows the runtime environment to pick up the resource.

For the most part, the source code directory isn't on the runtime classpath.

-Cameron McKenzie
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic