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.
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
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
1. Open **Eclipse** → **Settings**
2. Navigate to **Maven**
3. Check both options:
- ☑ Download Artifact Sources
- ☑ Download Artifact JavaDoc
4. Click **Apply and Close**
:::
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:
- Enabling Downloads overrides the default external resource blocking
- JavaDoc/Sources Inclusion indirectly permits DTD validation through Maven's resource handling
- Config File Validation works because DTD checking is treated similarly to artifact dependencies
- Security Balance maintains Eclipse's secure defaults while allowing necessary external access
Alternative Approach
If issues persist:
- Open Preferences → XML → XML Files → Validation
- Uncheck "Disable external resource loading"
- 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.