File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem with validation dtd Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with validation dtd" Watch "Problem with validation dtd" New topic
Author

Problem with validation dtd

David Wimmer
Greenhorn

Joined: Jun 01, 2011
Posts: 13
Hello,

i am using struts2 framework and want to validate my fields with the xml method.
I have read the tutorials at the struts homepage, but eclipse gives me the this error:

- Referenced file contains errors (http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd).



Haven't found a solution yet. I hope you can help me.
Darrin Lemmer
Greenhorn

Joined: Jun 01, 2011
Posts: 1
I haven't found a good solution yet, either, but the problem becomes apparent when you try to go to the URL where the DTD resides, http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd. Instead of getting the DTD, you are redirected to a page saying that the opensymphony.com site has been removed, which I think may have just happend on Monday, May 30. Since the xwork stuff is now part of struts.apache.org, one would have hoped that they would have had the foresight to transfer these DTD files to that domain, and set up redirects on opensymphony.com to go to the new URL, but that doesn't seem to be the case. They do have the site archived, and you can get to the DTD using this URL: http://web.archive.org/web/20090222210559/http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd but that is certainly not a long term solution. The DTD also resides in the xwork jar file, but I haven't found a way to reference the DTD in the jar without using an absolute path, which also isn't a practical solution. I think we are stuck until the xwork DTDs are hosted on struts.apache.org.
Alex Winner
Greenhorn

Joined: Jun 01, 2011
Posts: 5
I have same problem, and found that because when I trying to access http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd I see that project got closed and the link is not valid anymore. I just removed the error dtd link (temporary fix, before apache get new link work)

<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

and get it works though there is still a warning.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

So you do have a local copy of the DTD (in the xwork jar file)... then the problem is to tell the parser to use that local copy instead. I have no idea how you would do that in Struts but for the general idea of the available mechanisms, have a look at this Wikipedia article: XML Catalog.
Jonathan Lewis
Greenhorn

Joined: Jun 01, 2011
Posts: 3
I ran into the same thing...I just extracted the file from xwork-core-2.2.1.jar, copied it into WEB-INF and replaced the opensymphony dtd reference with


It seems to work like a champ.

-Jonathan
David Wimmer
Greenhorn

Joined: Jun 01, 2011
Posts: 13
Thanks to all

I have copied the dtd from the webarchiv into a xml file and put it into the WEB-INF folder as Jonathan Lewis mentioned.

Works fine and now I can validate my fields
Jonathan Lewis
Greenhorn

Joined: Jun 01, 2011
Posts: 3
Cool! I posted this same issue to the struts user group that is run by Dave Newton....

Hopefully he can get in touch with someone that can eventually host any public files that were on opensymphony.com. I can't believe they pulled the plug without re-hosting their files...
michael paquette
Greenhorn

Joined: Jun 01, 2011
Posts: 1
Hey Guys - we solved this problem by copying the dtd into the file validators.xml

<!DOCTYPE validators [
<!ELEMENT validators (validator)+>

<!ELEMENT validator (#PCDATA)>
<!ATTLIST validator
name CDATA #REQUIRED
class CDATA #REQUIRED
>
]>


This seems to have revealed a bug in their XML configuration parsing
logic; hence, the app fails to load the DTD file from a local "jar"
library instead of the internet; we're expecting hundreds of websites
would be suffering of this issue by now.

I can't believe OpenSymphony didn't setup some url forward to the dtd's. I don't think they know about this problem.

Hope this helps

Disheng Lin
Greenhorn

Joined: Jun 02, 2011
Posts: 1
It does not complaint for the reference by putting the dtd into the web-inf however it doesn't work for me. what I can do is use the internal dtd as michael did
Jonathan Lewis
Greenhorn

Joined: Jun 01, 2011
Posts: 3
Per the struts user group: Public files have been re-hosted here: (xwork dtds should be put up there soon....not yet though)

http://struts.apache.org/dtds/
Juan Manuel Aragones
Greenhorn

Joined: Jun 02, 2011
Posts: 1
Hi,

I extracted the "xwork-core-2.2.1.jar" file in WEB-INF directory and I replaced the opensymphony dtd reference with the local reference... but not works.
The same thing that if there aren't validators xml.

Any alternative or new idea??

Thanks, Juan Manuel
Lukasz Lenart
Greenhorn

Joined: Jun 02, 2011
Posts: 1
You can wait a bit and try to download the latest development version from here [1], I've just posted updates to DTDs. You can try to use xwork-core.jar directly if your Struts version is 2.1 or 2.2, if not extract DTDs and replace what you have in your xwork.jar


[1] https://builds.apache.org/view/S-Z/view/Struts/job/Struts2/lastStableBuild/

Lukasz
Gladwin Burboz
Greenhorn

Joined: Feb 26, 2008
Posts: 25
Jonathan Lewis wrote:Per the struts user group: Public files have been re-hosted here: (xwork dtds should be put up there soon....not yet though)

http://struts.apache.org/dtds/


New URL works for us !!!.

Now OpenSymphony has seen it's final days. All xml have to change the dtd to struts.apache.org. xworks related DTD's have been uploaded on "2011-06-02 17:47"

In eclipse you will get below mentioned error which can be resolved as specified by this solution.




E.g. To fix your validation xml files.

Old way of validation DTD



Replace with New validation DTD



<a href="http://www.sealordresortarnala.com" target="_blank" rel="nofollow">http://www.sealordresortarnala.com</a>
Glenn Puckett
Greenhorn

Joined: Sep 09, 2008
Posts: 16
This is the very reason I am reluctant to have ANY links to external sites that my production level application requires. It's great until that company has a policy change or goes out of business. No, everything from jQuery to dtd's go on my own directories where I KNOW they will be there tomorrow and the next day and every day after that as long as my website is operational.
Gladwin Burboz
Greenhorn

Joined: Feb 26, 2008
Posts: 25
Glenn Puckett wrote:This is the very reason I am reluctant to have ANY links to external sites that my production level application requires. It's great until that company has a policy change or goes out of business. No, everything from jQuery to dtd's go on my own directories where I KNOW they will be there tomorrow and the next day and every day after that as long as my website is operational.


This change does not directly impacts any existing deployed production systems as required DTDs are bundled with respective JARs.
Changes listed above are done only to satisfy eclipse IDE and there are also other work around to do same.
 
 
subject: Problem with validation dtd
 
Similar Threads
dtd not found
Struts 2 error
Struts2 Field Validator in XML - regex issue
short-circuit attribute not working in validation file
Struts2 ActionName-Validation.xml Error Help Needed