87

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>
1
  • 1
    Dont forget to enable spring plugins
    – guesswho
    Apr 13, 2018 at 2:14

13 Answers 13

99

You can easy solve it by: Fetch external resource.

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

7
29

This did the work:

Alt+Enter -> Fetch external resource

14

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.

1
  • 4
    No XML at the specified location: jakarta.apache.org/log4j Oct 7, 2021 at 5:47
13

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.

3
  • May I know if is it safe to just using option 3 "Ignore external resource"?
    – Frankey
    Aug 19, 2021 at 10:53
  • If option 2 does not work then that might be OK I think.
    – Saikat
    Aug 24, 2021 at 17:52
  • When "2" is selected it opens a Map External Resource. Clicking OK retools the warning to say: "Resource registered by this uri is not recognized."
    – Jamie
    Nov 3, 2022 at 13:42
7

For me Build > Clean Project worked.

3

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.

3

I tried the answers above but none worked. It ended up working fine when I used:

FIle | Invalidate Caches...

Mark everything and click Invalidate and Restart

It will restart IntelliJ and everything was working

1

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

1

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.

0

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.

0

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

0

In my case, I solved it by ignoring external resource:

img

0

I used Fetch External resource initially but the error didn't go. Then I invalidated the cache and it worked for me.

1
  • Maybe this is a question. not a any answer Dec 22, 2022 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.