Skip to Content
author's profile photo Former Member
Former Member

Web Dynpro: Where put hibernate hibernate.cfg.xml?

I have seen several people asking about the place to put the config file of Hibernate, but not any conclusive answer until now...

I created a external library in WAS (I verified using Visual Admin that the lib was correctly deployed). In my Web Dynpro References -> Library Reference I add the library in the format Provider Name/Library Name: "sap.com/hiblibs"

<b> Where can I store the hibernate.cfg.xml?</b> I have tried put it in all web dynpro folders!

Thanks,

Ivan Garcia

From Brazil

<b> This is my source code:</b>

Configuration cfg = new Configuration();

cfg.configure("hibernate.conf.xml");

<b> The error:</b>

org.hibernate.HibernateException: hibernate.conf.xml not found

at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)

at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1402)

at org.hibernate.cfg.Configuration.configure(Configuration.java:1424)

I have read all forum topics about this, including:

Where to put config files in webdynpro ?

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2ae0614a-0601-0010-a491-a9a635f06613

Problem in placing hibernate.cfg.xml

/people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas

/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

How to add external jar in web dynpro without going for DC

Web Dynpro References

Using External Library in Web Dynpro - Error

Deploy external jar to WAS 6.40

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 02:47 AM

    Ivan,

    Did you try to put this file right under src/packages?

    If so, please check whether or not it get included in EAR/JAR after build.

    Also try to rename it to hibernate.cfg.hbml and use cfg.configure("hibernate.conf.hbml") -- some NW IDE resist to include files with xml extension, so it's necessary to fake them.

    Valery Silaev

    SaM Solutions

    http://www.sam-solutions.net

    Message was edited by:

    Valery Silaev

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 11, 2007 at 02:33 PM

    Ivan,

    I've faced with this error and I solved using the following way:

    1 - Create a DC library Project - Put the hibernat's jar files at this project and create a public part. Don't forget to create an assembly and build component.

    2 - Create a DC Java Projet - Put all Hibernat classes at this project (POJOS, Comands and Utils) and the library project as "used DC". Put the hibernate.cfg.xml over the src/package folder. Create a public part.

    3 - Create a DC Web Dynpro - Add the hibernate and java project as used DC.

    Create a Java Bean Model and create the applications. In your web dynpro code, just call the Commands classes.

    Build the web dynpro DC and do its deploy!

    At this way will work fine.

    Regards,

    Luciano

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.