Question

I'm having trouble figuring out how to solve this issue. I have a file called: "urlrewrite.xml" which was automatically generated by spring ROO after running the "controller" command in ROO Shell.

However, I still get the following error:

"Referenced file contains errors (http://tuckey.org/res/dtds/urlrewrite3.0.dtd). For more information, right click on the message in the Problems View and select "Show Details..."

Here's the content of the urlrewrite.xml file:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">

<urlrewrite default-match-type="wildcard">
    <rule>
        <from>/resources/**</from>
        <to last="true">/resources/$1</to>
    </rule>
    <rule>
        <from>/static/WEB-INF/**</from>
        <set type="status">403</set>
        <to last="true">/static/WEB-INF/$1</to>
    </rule>
    <rule>
        <from>/static/**</from>
        <to last="true">/$1</to>
    </rule>
    <rule>
        <from>/</from>
        <to last="true">/app/index</to>     
    </rule>
    <rule>
        <from>/app/**</from>
        <to last="true">/app/$1</to>
    </rule>
    <rule>
        <from>/**</from>
        <to>/app/$1</to>
    </rule>
    <outbound-rule>
        <from>/app/**</from>
        <to>/$1</to>
    </outbound-rule>    
</urlrewrite>

Any thoughts on how to get rid of this error?

Was it helpful?

Solution

Just change 3.0 to 3.2

<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
    "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">

OTHER TIPS

i also got this problem. what i did was i just change the code from :

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
        "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">

into :

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//www.tuckey.org//DTD UrlRewrite 3.2//EN"
        "http://www.tuckey.org/res/dtds/urlrewrite3.2.dtd">

basically, i just appended the "www." before the "tuckey.org" and it fixed the issue.

http://forum.springsource.org/showthread.php?t=90962 led me to the right path.

If you download the DTD from http://tuckey.org/res/dtds/urlrewrite3.0.dtd you will find that sometimes it is correct and sometimes it is empty HTML. Eclipse caches what it downloads either way. You can fix the problem two ways:

  1. Download the DTD file yourself, verify that it looks like an XML DTD, store it locally, and point at this in your urlrewrite.xml header.
  2. Go to Preferences -> General -> Network Connections -> Cache and remove the cached DTD, then revalidate the XML (Right-click -> Validate). Repeat until you get a good copy of the DTD cached.

Add www to link works for me, i changed from

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
    "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">

to

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
    "http://www.tuckey.org/res/dtds/urlrewrite3.0.dtd">

Hi I just solved this based on a few of these answers here:

The steps I followed were:
1. Downloaded the urlrewrite3.2.dtd
2. saved it locally to ...war/WEB-INF/urlrewrite3.2.dtd
3. pointed my URLrewrite file to the local copy
4. removed the cached version (Preferences>General>Network Connections>Cache)
5. Revalidated the XML

Note: I initially tried editing the file as was suggested by Titi Wangsa bin Damhore but there i got a validation error in the dtd file. I removed that followed the steps above and boom. Problem solved. Thanks to those who contributed ideas.

Blockquote

did some googling "sample dtd" 4th or 5th result was http://www.xmlfiles.com/dtd/dtd_examples.asp

the sample had a

<!DOCTYPE TVSCHEDULE [ 
<!ELEMENT TVSCHEDULE (CHANNEL+)>
..
..
]>

the url rewrite dtd started with

<!ELEMENT urlrewrite ((rule|class-rule)*, outbound-rule*, catch*)>

i issued a wget for ""http://tuckey.org/res/dtds/urlrewrite3.0.dtd"" and opened in in sts, yup, its red.

added at the top

<!DOCTYPE urlrewrite [

and ad the bottom

]>

and its no longer red.

so i suggest,

  1. get the dtd
  2. alter it
  3. save it in the same directory as the xml
  4. alter the xml to use the dtd in the same directory.

In IntelliJ IDEA, you can select the red DTD URI, hit Alt-Enter, then choose "Fetch external resource".

In Eclipse, you can add the entry to the XML catalog under: Preferences -> XML -> XML Catalog.

I hope this helps.

Changing 3.0 to 3.2 worked for me...

I got the DTD ... saved it in the same directory as the xml and altered it. now there's a red in the DTD and xml

The markup declarations contained or pointed to by the document type declaration must be well-formed. urlrewrite3.0.dtd

Referenced file contains errors (....App/src/main/webapp/WEB-INF/urlrewrite3.0.dtd). ..

Please upload your xml file and dtd file.

I used user374708 method and cleared network cahce, like shown in Nearmars post

It's better to download the DTD and point to it with an XML catalog entry, as this makes it unnecessary to change the DTD when publishing, yet your files will be validated locally while developing.

I have figured out the problem. Try this url http://tuckey.org/res/dtds/urlrewrite3.1.dtd with your browse and you will see it's redirecting you to completely different html page instead of dtd file. So here is what I did. I found dtd file from tuckey jar and copied the content to {workspace}/.metadata/.plugins/org.eclipse.wst.internet.cache/279269156.cache and deleted the warnings from markers view and revalidated. Rememer 279269156.cache cache file's name will vary. So you have to find which is the bad file by opening the cache file with some editor

That issue has been fixed for the next release... https://jira.springsource.org/browse/ROO-1129

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top