# Hibernate fails to read DTD intermittently

**URL:** <https://discourse.hibernate.org/t/hibernate-fails-to-read-dtd-intermittently/58>\
**Category:** Hibernate ORM\
**Created:** [January 11, 2018, 3:41pm UTC](https://discourse.hibernate.org/t/hibernate-fails-to-read-dtd-intermittently/58 "2018-01-11T15:41:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tharahan\_Muthu](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@Tharahan\_Muthu](https://discourse.hibernate.org/u/Tharahan_Muthu)\
**Post date:** [January 11, 2018, 3:41pm UTC](https://discourse.hibernate.org/t/hibernate-fails-to-read-dtd-intermittently/58/1 "2018-01-11T15:41:57Z")

</div>

We have recently upgraded to 4.1.7 and are experiencing issue time to time (very intermittently) on initializing SessionFactory because of unable to read DTD remotely.

```auto
Configuration configuration = new Configuration().configure();
			ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()). buildServiceRegistry();
			sessionFactory = configuration.buildSessionFactory(serviceRegistry);

```

If we switch to referencing locally, all works well.

```auto
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

To

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration SYSTEM 
    "classpath://org/hibernate/hibernate-configuration-3.0.dtd">

```

We don’t this this is due to network. We are able to reference all other schema references when this one fails

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [January 11, 2018, 4:03pm UTC](https://discourse.hibernate.org/t/hibernate-fails-to-read-dtd-intermittently/58/2 "2018-01-11T16:03:55Z")

</div>

This is how the DTD looks like in Hibernate 5.

```auto
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

```

Now, you can also use a local DTD, if that works faster for you. Just update your HBM files and hibernate.cfg.xml to reference the local one.

---

<div class="post-metadata">

**Author:** ![Tharahan\_Muthu](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@Tharahan\_Muthu](https://discourse.hibernate.org/u/Tharahan_Muthu)\
**Post date:** [January 11, 2018, 4:39pm UTC](https://discourse.hibernate.org/t/hibernate-fails-to-read-dtd-intermittently/58/3 "2018-01-11T16:39:28Z")

</div>

> [@Tharahan\_Muthu](#):
>
> [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd](http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd)

Thanks Vlad for your quick reply.
