It's all about the answers!

Ask a question

OSLC workshop RM code runs on one server and fails on another


Tali Rabetti (1018) | asked Apr 26 '17, 4:26 a.m.
edited May 01 '17, 7:27 a.m.

Hi,
I tried to run the rm examples provided in the OSLC workshop
https://jazz.net/wiki/pub/Main/OSLCWorkshopDownload/2012-11-26-OSLC-workshop.pdf (Lab 6)

Examples 1 and 2 run successfully. Example 3 is the first to use sendGetForSecureDocument to get the catalog.
I have two DNG projects on two different servers. It works on one of them and fails on the other. Any idea what could be the difference?
The passing server has 6.0.2 and the failing one 6.0.3, could that be the reason?

It fails with exception, after some warnings. See below the console output.
It complains about "&". It seems that it is a side effect of the real problem. Can someone suggest what is wrong?

Thank you!

Here is the console log:
>> Example03: Print out the content of the Service Providers catalog
    - Root Services URI: https://XXXXX/rm/rootservices
    - Service Providers catalog XPath expression: /rdf:Description/oslc_rm:rmServiceProviders/@rdf:resource
    - Service Provider title XPath expression: //oslc:ServiceProvider/dcterms:title
    - Login: -----------------------
    - Password: ------------------------
>> GET(1) https://XXXXX/rm/rootservices
>> Response Headers:
    - X-Powered-By: Servlet/3.0
    - ETag: "24RrgBYa77AQ0yyQv99Kuw/kCvI="
    - Date: Wed, 26 Apr 2017 08:03:10 GMT
    - Expires: Wed, 26 Apr 2017 08:08:10 GMT
    - Cache-Control: public
    - Content-Type: application/rdf+xml; charset=UTF-8
    - Content-Length: 8414
 >> sending request to: https://XXXXX/rm
>> GET(1) https://XXXXX/rm/oslc_rm/catalog
Apr 26, 2017 11:03:16 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-5909864177e4454da4ce8d7a5e58d6db="JKvtmwfmiZKFPjkvqVQwkNJ73dJKeWRaLuGPfle1ev8"; Version=1; Max-Age=600; Expires=Wed, 26-Apr-2017 08:13:11 GMT; Path=/rm; secure; HttpOnly". Unable to parse expires attribute: Wed
>> Response Headers:
    - X-Powered-By: Servlet/3.0
    - X-com-ibm-team-repository-web-auth-msg: authrequired
    - Content-Type: text/html; charset=UTF-8
    - Content-Length: 1990
    - Set-Cookie: JazzFormAuth=Form; Path=/jts; Secure
    - Date: Wed, 26 Apr 2017 08:03:11 GMT
    - Expires: Thu, 01 Dec 1994 16:00:00 GMT
    - Cache-Control: no-cache="set-cookie, set-cookie2"
>> POST https://XXXXX/jts/j_security_check
Apr 26, 2017 11:03:21 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: WASReqURL=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly". Unable to parse expires attribute: Thu, 01 Dec 1994 16:00:00 GMT
    - Date: Wed, 26 Apr 2017 08:03:12 GMT
    - X-Powered-By: Servlet/3.0
    - Location: https://XXXX/jts/secure/authenticated/identity?redirectPath=%2Fjts%2Foauth-authorize%3Foauth_token%3D5909864177e4454da4ce8d7a5e58d6db
    - Content-Language: en-US
    - Set-Cookie: jazz0818443ltpatoken=KqeJ3lGcBCtHNblM43Moz6+o1iqExc2QU6kHil7VZj5bk2yOQ+JUpqszsyNS6JOdG7oPIYUoAPtsK83+/i3gcaYMZbwbVXvPgcI8uYP7r0YucJO4/hQElTTCWcc/TnYJWu9jDEN9a/kBIdM7VgMODMYa43TalAeq78uWsD3CFYqOkpyCCQCeCkV5OCUIupksV2Z1KZn0SSQiEDQ8h2gxLDQOBIQObaqL+vttwGFzJqBEwJdXeheuD7nyn2ltGe5jc54ql0X5cQ60dH+2pP+ZVtA+p1v3JirenF+Cykr+HXXauHpvBNvSR/BJvecQaDsSF5/t3efW2c24vvCvLcl4xmFgXbBzAcmNekJa1k+Fmg/T0e0ioRlEb3fIYM/jdsZY; Path=/; Domain=rchland.ibm.com; Secure; HttpOnly
    - Set-Cookie: WASReqURL=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly
    - Transfer-Encoding: chunked
    - Expires: Thu, 01 Dec 1994 16:00:00 GMT
    - Cache-Control: no-cache="set-cookie, set-cookie2"
Apr 26, 2017 11:03:22 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: jfs-request-token-46def8784745400fa5396c28a026b997="GaRInbRn33de9U75EOEGdOZmm0VFrdGj5X8AuhTSOM"; Version=1; Max-Age=600; Expires=Wed, 26-Apr-2017 08:13:17 GMT; Path=/rm; secure; HttpOnly". Unable to parse expires attribute: Wed
 >> sending request to: https://XXXXX/rm
[Fatal Error] :26:31: The entity name must immediately follow the '&' in the entity reference.
org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 31; The entity name must immediately follow the '&' in the entity reference.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:466)
    at net.jazz.oslc.consumer.examples.Example03.main(Example03.java:119)
--------------- linked to ------------------
javax.xml.xpath.XPathExpressionException: org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 31; The entity name must immediately follow the '&' in the entity reference.
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:471)
    at net.jazz.oslc.consumer.examples.Example03.main(Example03.java:119)
Caused by: org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 31; The entity name must immediately follow the '&' in the entity reference.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:466)
    ... 1 more




Comments
Tali Rabetti commented Apr 26 '17, 5:18 a.m.

Update: I tried on a different project, located on a different server, and the code worked. So it is related to the server. Any clue?

One answer



permanent link
Donald Nong (14.3k211) | answered May 01 '17, 8:44 p.m.

I have seen this before but cannot recall the exact cause at the moment.

If it complains about the response body, the easiest way is just dump it out and check the location (lineNumber: 26; columnNumber: 31;) that the error complains about.

Your answer


Register or to post your answer.