Announcement Announcement Module
Collapse
No announcement yet.
How to configure hibernate.cfg.xml to work offline Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to configure hibernate.cfg.xml to work offline

    I use standard hibernate.cfg.xml file that start like this :

    Code:
    <!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
      <session-factory>...
    My system is working offline (only local network). How do I define it to work with local dtd file?

  • #2
    It will not a issue; since dtd file will be part "hibernate.jar"

    Comment


    • #3
      Originally posted by vvairam View Post
      It will not a issue; since dtd file will be part "hibernate.jar"
      what do u mean? I know that the file is in the jar. What do I need to configure to let the system know to take it from there?

      Comment


      • #4
        first your application looks for a dtd in the classpath; since the hibernate.jar in classpath;

        you will be not run into any issue.

        Comment


        • #5
          this is what I get :
          Code:
          org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/hibernate.cfg.xml]; nested exception is java.net.UnknownHostException: hibernate.sourceforge.net.......
          
          Caused by: java.net.UnknownHostException: hibernate.sourceforge.net

          Comment


          • #6
            you may need to change the dtd configuration to lookup the dtd file from the local system

            <!DOCTYPE hibernate-configuration SYSTEM "hibernate-configuration-3.0.dtd">

            find them in hibernate document.

            Comment


            • #7
              Find more here

              Comment


              • #8
                I never had a issue with a standalone application

                because the hibernate document says

                Hibernate DTD is sophisticated. Hibernate will not load the DTD file from the web, but first look it up from the classpath of the application. The DTD file is included in hibernate-core.jar (it is also included in the hibernate3.jar, if using the distribution bundle).

                Comment


                • #9
                  check your classpath hibernate.jar file; configure the same dtd file which present in your hibernate jar file.

                  Code:
                  net.UnknownHostException: hibernate.sourceforge.net


                  Its trying to find the dtd from web meaning it is not finding the right dtd file from your classpath;

                  Comment


                  • #10
                    I know what you mean, It should use the dtd from the jar but I get:
                    Code:
                    Nov 23, 2009 6:21:43 PM org.apache.catalina.core.StandardContext loadOnStartup
                    SEVERE: Servlet /appbeatcn threw load() exception
                    java.io.FileNotFoundException: Could not open ServletContext resource [/hibernate-configuration-3.0.dtd]

                    Comment

                    Working...
                    X