Pipeline and XNATRestClient: Exception in thread "main" java.lang.NullPointerException

86 views
Skip to first unread message

Sven Prevrhal

unread,
Sep 29, 2015, 1:01:04 PM9/29/15
to xnat_discussion
Hi there,
I am debugging a pipeline of mine. It launches and creates the build directories fine, but then I get the following:

$ /home/xnat/pipelines/xnat-tools/XNATRestClient -u xnat -p ** -host https://dev.pf-xchg.de/xnat/ -remote /data/archive/projects/oar_example/subjects/DRTHERAPAT_DEV_S00128/experiments/DRTHERAPAT_DEV_E00329/scans/ALL/resources/DICOM,secondary/files\?format=zip\&structure=legacy -m GET > /home/xnat/build/oar_example/20150929_181734//RAW/x.zip
Exception in thread "main" java.lang.NullPointerException
        at java.io.Writer.<init>(Writer.java:88)
        at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:109)
        at java.io.PrintWriter.<init>(PrintWriter.java:148)
        at java.io.PrintWriter.<init>(PrintWriter.java:131)
        at org.nrg.xnat.client.rest.WSTool.logError(WSTool.java:402)
        at org.nrg.xnat.client.rest.WSTool.error(WSTool.java:234)
        at org.nrg.xnat.client.rest.WSTool.perform(WSTool.java:133)
        at org.nrg.xnat.client.rest.XNATRestClient.main(XNATRestClient.java:304)

Please help !

Best regards
Sven

Herrick, Rick

unread,
Sep 29, 2015, 1:24:22 PM9/29/15
to xnat_di...@googlegroups.com
Hard to say. This looks like it’s getting an error trying to log an error. In other words, an error occurred, the REST client tried to write out information about that error, and in the course of doing so encountered another error. Errors all around!

Could you switch to using the XNAT data client? The REST client is pretty old code and not actively maintained. XDC is actively maintained and enhanced. If nothing else, it should give you better information on what’s going wrong in the first place.

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961


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



The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Mohana Ramaratnam

unread,
Sep 29, 2015, 1:25:54 PM9/29/15
to xnat_di...@googlegroups.com

Can you try using the curl command on the command line (ie independent of the pipeline) to GET the file and see if that works.


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

Mohana Ramaratnam

Sven Prevrhal

unread,
Sep 30, 2015, 7:19:56 PM9/30/15
to xnat_discussion
Thanks - How do I switch? I have the 1.6.4 pipeline engine, do I need to upgrade that, or do I simply replace the corresponding lines in the pipeline xml descriptor? Can you point me to or send me an example xml that shows me how to down- and upload with the XNAT data client? Also, if that's any useful information, all pipelines fail at the download step with the same error.

Sven

Sven Prevrhal

unread,
Sep 30, 2015, 7:22:22 PM9/30/15
to xnat_discussion
Hi Mohana,
How do I do that? The path in -remote of the XNATClient is a XPATH not an actual path on the machine's file system right? I couldn't use this with curl, or could I?

Sven

Sven Prevrhal

unread,
Sep 30, 2015, 7:56:59 PM9/30/15
to xnat_discussion
Today it is a different error. Running the *same' XNATRestClient again, I see 

ERROR CODE 13: Unable to connect to Web Service Server: https://dev.pf-xchg.de/xnat/.
Error logged in /home/xnat/error.log

and the error in that log is

Thu Oct 01 01:27:28 CEST 2015 xnatadmin@https://dev.pf-xchg.de/xnat/:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed

This is, I understand a problem with the certificates. I have not understood at all how java actually handles the certificates, I do value your help here! 

Here is the XNATRestClient script and my java

xnat@rs210205:~$ more  /home/xnat/pipelines/xnat-tools/XNATRestClient
java -jar /home/xnat/pipelines/lib/xnat-rest-client-1.6.4.jar $@
xnat@rs210205:~$ which java
/usr/bin/java
xnat@rs210205:~$ readlink -f /usr/bin/java | sed "s:bin/java::"
/usr/lib/jvm/java-7-oracle/jre/
xnat@rs210205:~$ ls -l /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts
-rw-r--r-- 1 root root 94618 Mar  9  2015 /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts

Is this correct? I wonder why the pipelines fail now, given that the cacerts have not been changed for a while.

When I check my XNAT web site in the browser, I see that the GlobalSign root cert is in the keystore

$ keytool -list -v -keystore  /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts | grep GlobalSign
Owner: CN=GlobalSign Root CA, OU=Root CA, O=GlobalSign nv-sa, C=BE
Issuer: CN=GlobalSign Root CA, OU=Root CA, O=GlobalSign nv-sa, C=BE

Am I on the right path or is this error pointing to something else?

Sven

On Tuesday, September 29, 2015 at 7:24:22 PM UTC+2, Rick Herrick wrote:

Sven Prevrhal

unread,
Sep 30, 2015, 8:19:10 PM9/30/15
to xnat_discussion
So I downloaded and installed the XnatDataClient, and called it like so:


I get the same error as I posted earlier:

Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...
 at org.nrg.xnat.client.data.XnatDataClient.main(XnatDataClient.java:82)




On Tuesday, September 29, 2015 at 7:24:22 PM UTC+2, Rick Herrick wrote:

Sven Prevrhal

unread,
Oct 8, 2015, 5:34:46 AM10/8/15
to xnat_discussion
I fixed it. This was obviously a problem with the java keystore. I hadn't known that one has to also import the intermediate certificates. Well now I know.
Sven
Reply all
Reply to author
Forward
0 new messages