user224270
user224270

Reputation: 567

Spring ROO issue with UrlRewrite in STS (eclipse)

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?

Upvotes: 7

Views: 4971

Answers (14)

Gordon Dickens
Gordon Dickens

Reputation: 1

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

Upvotes: 0

SonTL
SonTL

Reputation: 361

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">

Upvotes: 3

beku8
beku8

Reputation: 611

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

Upvotes: 0

xtrycatchx
xtrycatchx

Reputation: 354

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.

Upvotes: 7

MiB
MiB

Reputation: 611

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.

Upvotes: 0

martin.masa
martin.masa

Reputation: 10542

Changing 3.0 to 3.2 worked for me...

Upvotes: 1

abele
abele

Reputation: 437

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

Upvotes: 0

Nearmars
Nearmars

Reputation: 21

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

Upvotes: 2

sosiouxme
sosiouxme

Reputation: 1256

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.

Upvotes: 5

Rudy
Rudy

Reputation: 212

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">

Upvotes: 10

schuess
schuess

Reputation: 11

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.

Upvotes: 1

santhosh S
santhosh S

Reputation: 1

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.

Upvotes: 0

Titi Wangsa bin Damhore
Titi Wangsa bin Damhore

Reputation: 7199

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.

Upvotes: 1

Related Questions