URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs) in applicationContext.xml

XmlIntellij Idea

Xml Problem Overview


I created an application Context.xml at the WEB-INF/classes directory. and I have added the <!DOCTYPE> in the xml. I am getting the below error:

> URI is not registered (Settings | Languages & Frameworks | Schemas and DTDs)

You can see the snapshot below:

enter image description here

The xml is below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">  // -> there comes the issue
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>

Xml Solutions


Solution 1 - Xml

You can easy solve it by: Fetch external resource.

https://i.stack.imgur.com/mJIuN.jpg" width="222">

Click the light(your is red) -> Fetch external resource.

Solution 2 - Xml

This did the work:

Alt+Enter -> Fetch external resource

Solution 3 - Xml

I'm assuming this is in IntelliJ IDEA or some other JetBrains tool. If you place the cursor over the URL (or select it), you should see a red bulb on the left border of the window. That red bulb, when clicked, will give you some options to correct any errors. One of the options should be to download the DTD (Fetch external resource). Do that and the error should go away.

Solution 4 - Xml

If you select and hit ALT+ENTER i.e. More Actions... then following options would be displayed:

1. Add xsi schema location for external resource
2. Fetch external resource <- my preferred way
3. Ignore external resource
4. Manually setup external resource

Most of the time you would either select option no. 2 or 3 to get rid of this error.

Solution 5 - Xml

For me Build > Clean Project worked.

Solution 6 - Xml

Times change and Apache simply does not support that 1.xx version of log4j anymore. That XML really is not there on that address.

log4j is dead. Long live log4j2!
Look here: https://logging.apache.org/log4j/2.x/manual/migration.html.

New configuration language is shorter and more convenient:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
  <Appenders>
    <Console name="STDOUT" target="SYSTEM_OUT">
      <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Logger name="org.apache.log4j.xml" level="info"/>
    <Root level="debug">
      <AppenderRef ref="STDOUT"/>
    </Root>
  </Loggers>
</Configuration>

If you feel you must use the old version, you should download the old XML that lived at the old address, put it on your server and use the new address.

Solution 7 - Xml

In my case, I was opening XML resource files from debug build variant while my Android Studio had beta build variant selected.

I switched to the debug build variant (to which the XML file belonged) and voila! errors gone.

enter image description here

Solution 8 - Xml

If you're in a JetBrains context, and Fetch external resource does not work, try File -> Invalidate Caches. Equivalent to clean project in eclipse, as mentioned in other answers.

Solution 9 - Xml

If "fetch" does not help, it means You have created this xml-file as empty file with .xml extention and filled config manually. Now delete it and recreate it propperly as "Spring config" file from template.

Solution 10 - Xml

Clean project worked for me. go to Build then click clean project.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionqg_java_17137View Question on Stackoverflow
Solution 1 - XmlaircraftView Answer on Stackoverflow
Solution 2 - XmlGrandtourView Answer on Stackoverflow
Solution 3 - XmlBamaPookieView Answer on Stackoverflow
Solution 4 - XmlSaikatView Answer on Stackoverflow
Solution 5 - XmlThomasView Answer on Stackoverflow
Solution 6 - XmlGangnusView Answer on Stackoverflow
Solution 7 - XmlDarushView Answer on Stackoverflow
Solution 8 - Xmljumps4funView Answer on Stackoverflow
Solution 9 - XmlAleksey WertView Answer on Stackoverflow
Solution 10 - XmlNNEJI ObiomaView Answer on Stackoverflow