SAXParseException; systemId: http://testng.org/testng-1.0.dtd

1,201 views
Skip to first unread message

Nikesh

unread,
Mar 14, 2017, 11:28:29 PM3/14/17
to testng-users
Hi All,

I suddenly started to see some strange error message while parsing the testng XML (was working fine all time) ... this has started to happen from last 2 days and we never touch the code which parse the XML

org.xml.sax.SAXParseException; systemId: http://testng.org/testng-1.0.dtd; lineNumber: 1; columnNumber: 3; The markup declarations contained or pointed to by the document type declaration must be well-formed.

Any idea what's going on ....

Here is my XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="website">
  <listeners>
    <listener class-name="com.znalytics.framework.ZbraListener.MethodInterceptorListener"/>
    <listener class-name="com.znalytics.framework.ZbraListener.TestNGListener"/>
  </listeners>
  <test name="Znalytics Execution Report - website">
    <classes>
      <class name="com.znalytics.website.demo.WebSiteTestDemo"/>
    </classes>
  </test> <!-- Znalytics Execution Report - website -->
</suite> <!-- website --> 

⇜Krishnan Mahadevan⇝

unread,
Mar 14, 2017, 11:32:34 PM3/14/17
to testng...@googlegroups.com
Cedric/Julien,

Is this related in any way to recent changes that was done to the DTD as part of https://github.com/cbeust/testng/issues/1383 ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Nikesh Jauhari

unread,
Mar 14, 2017, 11:37:27 PM3/14/17
to testng...@googlegroups.com

⇜Krishnan Mahadevan⇝

unread,
Mar 14, 2017, 11:42:45 PM3/14/17
to testng...@googlegroups.com
Nikesh,

There's some discussion going on, on issue https://github.com/cbeust/testng/issues/1385 which Bruce opened up as a follow up to his post on StackoverFlow and also to the Google forums thread.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Cédric Beust ♔

unread,
Mar 14, 2017, 11:44:55 PM3/14/17
to testng...@googlegroups.com

On Tue, Mar 14, 2017 at 8:32 PM, ⇜Krishnan Mahadevan⇝ <krishnan.mahadevan1978@gmail.com> wrote:
Is this related in any way to recent changes that was done to the DTD as part of https://github.com/cbeust/testng/issues/1383 ?

Extremely likely, yes :-(

However, what's weird is that TestNG should be using its internal resolver to use the DTD that ships in the .jar, so theoretically, changing the DTD on the web should have had very little impact. I suspect the resolver might not be working correctly and as a result, each TestNG run is actually fetching that DTD from the web, which is a terrible prospect...

-- 
Cédric

Nikesh Jauhari

unread,
Mar 14, 2017, 11:50:26 PM3/14/17
to testng...@googlegroups.com
ok

we generate tons of testng xml on the fly for execution (and do some parsing) and these generated xml got the dtd reference to "http://testng.org/testng-1.0.dtd"
how do we solve this, lots of our clients are impacted with this change.

Thanks,
Nikesh


Cédric Beust ♔

unread,
Mar 14, 2017, 11:56:45 PM3/14/17
to testng...@googlegroups.com
So far, I've been unable to find a way to validate a DTD. XML validation, sure, everywhere. But DTD validators, no luck so far, except on an Eclipse forum (looks like Eclipse can do that, can one of you try it? I don't have Eclipse on this laptop).


-- 
Cédric

Krishnan Mahadevan

unread,
Mar 14, 2017, 11:57:46 PM3/14/17
to testng...@googlegroups.com

Cedric,

 

I ran a test locally in the TestNG codebase which re-iterates what you said.

 

I renamed the TestNG DTD in the codebase to something else and then kicked off a test.

 

I noticed the below error message

 

WARNING: couldn't find in classpath http://beust.com/testng/testng-1.0.dtd

Fetching it from the Web site.

org.testng.TestNGException: org.xml.sax.SAXParseException; systemId: http://testng.org/testng-1.0.dtd; lineNumber: 1; columnNumber: 3; The markup declarations contained or pointed to by the document type declaration must be well-formed.

     at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:324)

 

We do have an explicit warning in the code  (It’s a System.out.println though) which calls out explicitly that its trying to fetch from the website. (This warning has been there for more than 10 years now).

 

So I think the resolver is working fine here…

 

 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

 

From: <testng...@googlegroups.com> on behalf of Nikesh Jauhari <nikesh....@gmail.com>
Reply-To: <testng...@googlegroups.com>
Date: Wednesday, March 15, 2017 at 9:20 AM
To: <testng...@googlegroups.com>
Subject: Re: [testng-users] SAXParseException; systemId: http://testng.org/testng-1.0.dtd

 

ok

 

we generate tons of testng xml on the fly for execution (and do some parsing) and these generated xml got the dtd reference to "http://testng.org/testng-1.0.dtd"

how do we solve this, lots of our clients are impacted with this change.

 

Thanks,

Nikesh

 

On Tue, Mar 14, 2017 at 11:44 PM, Cédric Beust <ced...@beust.com> wrote:

 

On Tue, Mar 14, 2017 at 8:32 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:

Is this related in any way to recent changes that was done to the DTD as part of https://github.com/cbeust/testng/issues/1383 ?


Extremely likely, yes :-(

 

However, what's weird is that TestNG should be using its internal resolver to use the DTD that ships in the .jar, so theoretically, changing the DTD on the web should have had very little impact. I suspect the resolver might not be working correctly and as a result, each TestNG run is actually fetching that DTD from the web, which is a terrible prospect...

-- 

Cédric

--
You received this message because you are subscribed to the Google Groups "testng-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.


To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

 

--

You received this message because you are subscribed to the Google Groups "testng-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.

Cédric Beust ♔

unread,
Mar 15, 2017, 12:07:13 AM3/15/17
to testng...@googlegroups.com

On Tue, Mar 14, 2017 at 8:57 PM, Krishnan Mahadevan <krishnan.mahadevan1978@gmail.com> wrote:
WARNING: couldn't find in classpath http://beust.com/testng/testng-1.0.dtd

Is TestNG trying to load the resource as a URL string ("http://...") and not a resource ("/testng-1.0.dtd")?

Also, could the comments at the top of the DTD be the reason for the errors?

-- 
Cédric

Krishnan Mahadevan

unread,
Mar 15, 2017, 12:36:14 AM3/15/17
to testng...@googlegroups.com

Cedric,

 

Its trying to load just the DTD viz., “/testing-1.0.dtd” and NOT as a URL.

 

When it fails to load the resource, the error msg prints the publicId that’s passed to us via the resolveEntity() method. So I guess we are fine.

 

I don’t think there is any problems with the DTD as such as well that is hosted.

 

Here’s what I did. I deleted src/main/resources/testing-1.0.dtd and then downloaded the dtd

 

~/githome/OpenSource/testng/src/main/resources [master L| 1…4 1]

09:41 $ wget http://testng.org/testng-1.0.dtd

--2017-03-15 09:51:24--  http://testng.org/testng-1.0.dtd

Resolving testng.org... 205.186.183.235

Connecting to testng.org|205.186.183.235|:80... connected.

HTTP request sent, awaiting response... 302 Found

Location: https://raw.githubusercontent.com/cbeust/testng/master/src/main/resources/testng-1.0.dtd [following]

--2017-03-15 09:51:25--  https://raw.githubusercontent.com/cbeust/testng/master/src/main/resources/testng-1.0.dtd

Resolving raw.githubusercontent.com... 151.101.100.133

Connecting to raw.githubusercontent.com|151.101.100.133|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 8337 (8.1K) [text/plain]

Saving to: ‘testng-1.0.dtd’

 

testng-1.0.dtd                                     100%[================================================================================================================>]   8.14K  --.-KB/s    in 0.005s

 

2017-03-15 09:51:26 (1.72 MB/s) - ‘testng-1.0.dtd’ saved [8337/8337]

 

Now when I ran my test again, it worked fine.

 

The only issue seems to be when we don’t find a local dtd version in our Jar, and try to reach to the internet to get a valid one.

 

Error msg that I am seeing when setting up break-points:

 

:http://testng.org/testng-1.0.dtd:http://testng.org/testng-1.0.dtd:http://testng.org/testng-1.0.dtd:1:3:6:The markup declarations contained or pointed to by the document type declaration must be well-formed.

 

And oh btw, I downloaded eclipse, and validated the dtd that was downloaded. There were no errors.

 

Would this redirection have something to do here?

 

 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

 

From: <cbe...@gmail.com> on behalf of Cédric Beust <ced...@beust.com>
Reply-To: <testng...@googlegroups.com>
Date: Wednesday, March 15, 2017 at 9:36 AM
To: <testng...@googlegroups.com>
Subject: Re: [testng-users] SAXParseException; systemId: http://testng.org/testng-1.0.dtd

 

 

On Tue, Mar 14, 2017 at 8:57 PM, Krishnan Mahadevan <krishnan.ma...@gmail.com> wrote:

WARNING: couldn't find in classpath http://beust.com/testng/testng-1.0.dtd


Is TestNG trying to load the resource as a URL string ("http://...") and not a resource ("/testng-1.0.dtd")?

 

Also, could the comments at the top of the DTD be the reason for the errors?


-- 

Cédric

--

Cédric Beust ♔

unread,
Mar 15, 2017, 12:49:32 AM3/15/17
to testng...@googlegroups.com
Thanks for the detailed analysis, Krishnan, very helpful.

I think your hunch about redirection might be correct...


-- 
Cédric


--

To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.


To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.

Julien Herr

unread,
Mar 15, 2017, 11:27:53 AM3/15/17
to testng-users, ced...@beust.com
Yes, it looks default xml parsers don't follow url redirection... :(

But the initial request is not clear for me: from where is the parsing issue? From a testng run? From the ide? From a custom suite parser (like the pointed github issue)? 


Le mercredi 15 mars 2017 05:49:32 UTC+1, Cédric Beust ♔ a écrit :
Thanks for the detailed analysis, Krishnan, very helpful.

I think your hunch about redirection might be correct...


-- 
Cédric

Nikesh

unread,
Mar 15, 2017, 11:44:25 AM3/15/17
to testng-users, ced...@beust.com
Yes, we are parsing the testNG XML for our custom use.

-- 
Cédric


--

To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.


To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.

Julien Herr

unread,
Mar 15, 2017, 11:56:30 AM3/15/17
to testng-users, ced...@beust.com
Reply all
Reply to author
Forward
0 new messages