Skip to content

Downloading from External Resources Disabled in Hibernate DTD

Problem Statement

When configuring Hibernate in an Eclipse-based Maven project, you may encounter the error: "Downloading from external resources is disabled." This typically occurs when Eclipse attempts to validate the hibernate.cfg.xml file against the Hibernate DTD (Document Type Definition). The error prevents proper XML validation and can disrupt Hibernate configuration setup.

Error indicating downloading from external resources is disabled
Eclipse error message when external resource downloading is blocked

The core issue stems from Eclipse's security settings that intentionally block external resource downloads by default. This affects:

  • Validation of DTD references in hibernate.cfg.xml
  • XML file editing within Eclipse
  • Project setup for Hibernate mappings

Solution

The most effective solution is to modify Eclipse's Maven preferences to enable artifact download capabilities. This single configuration change resolves the external resource blocking behavior while maintaining security best practices.

Step-by-Step Fix

::: code-group-item Windows/Linux

markdown
1. Open **Window****Preferences**
2. Navigate to **Maven**
3. Check both options:
   - ☑ Download Artifact Sources
   - ☑ Download Artifact JavaDoc
4. Click **Apply and Close**

::: ::: code-group-item macOS

markdown
1. Open **Eclipse****Settings**
2. Navigate to **Maven**
3. Check both options:
   - ☑ Download Artifact Sources
   - ☑ Download Artifact JavaDoc
4. Click **Apply and Close**

:::

Maven settings solution in Eclipse
Required Maven preference settings in Eclipse

Verification

  • Save your hibernate.cfg.xml file after making changes
  • Eclipse should now successfully resolve external DTD references
  • Project builds should execute without XML validation errors

Why This Solution Works

The "Download Artifact" options control Eclipse's behavior regarding external resources:

  1. Enabling Downloads overrides the default external resource blocking
  2. JavaDoc/Sources Inclusion indirectly permits DTD validation through Maven's resource handling
  3. Config File Validation works because DTD checking is treated similarly to artifact dependencies
  4. Security Balance maintains Eclipse's secure defaults while allowing necessary external access

Alternative Approach

If issues persist:

  1. Open Preferences → XML → XML Files → Validation
  2. Uncheck "Disable external resource loading"
  3. Check "Honour all XML catalogs"

Important Note

This solution only affects Eclipse's development environment behavior. Command-line Maven builds (mvn clean install) are unaffected by these settings and will function normally.