Rest client NOT WORKING

108 views
Skip to first unread message

Nicolas Vinuesa

unread,
Sep 24, 2015, 8:08:04 AM9/24/15
to xnat_discussion
Hello everybody,

Unfortunately I found myself facing several problems after trying to update my xnat customization to 1.6.5.
1) I found that all my custom data types where not even taken into account by xnat 1.6.5 (after checking that all of them are in InstanceSettings.xml)
2) Since xnat 1.6.5 wasn't working for me, I tried to go back to xnat 1.6.4 (which was already working for me...), but when I ran setup.sh I bump into some maven errors (which of course I cannot solve since I think it is using maven 1).
3) Luckily I had somewhere another installed and built xnat 1.6.4 so I copied the entire plugin-resources folder and then rebuilt (./setup.sh): It built correctly.
4) The last problem is after having built my xnat and everything looks like it is working, I had the awful idea of launching some pipelines. In all of them (since I use XnatRestClient in all of my pipelines instead of using cURL for example) I get the following awful error message (from the pipeline log file):
-----------------------------abaci----------------
2015/09/24 13:57:12
Executing: /usr/local/ABACI/xnat/pipeline/xnat-tools/XNATRestClient -u d73da7a7-b237-405b-b88e-54f0b6f37528 -p ######## -host http://127.0.0.1:8080/xnat/ -remote "/data/archive/projects/test/subjects/abaci_S00002/experiments/abaci_E00002/scans/4/resources/NIFTI/files?format=zip&structure=legacy" -m GET > /Library/ABACI/build/test/20150924_135703/subject01_MR1/NIFTI/FLAIR.zip

--------------------------------------------------------------------------------------
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: xnat-rest-client.log (Permission denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:142)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
    at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
    at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
    at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
    at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:809)
    at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
    at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
    at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547)
    at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
    at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
    at org.apache.log4j.Logger.getLogger(Logger.java:104)
    at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:289)
    at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:109)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1116)
    at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:914)
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:336)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:310)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:685)
    at org.apache.commons.discovery.jdk.JDK12Hooks.<clinit>(JDK12Hooks.java:38)
    at org.apache.commons.discovery.jdk.JDKHooks.<clinit>(JDKHooks.java:31)
    at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:363)
    at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:328)
    at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)
    at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:33)
    at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
    at org.apache.axis.client.Service.getAxisClient(Service.java:104)
    at org.apache.axis.client.Service.<init>(Service.java:113)
    at org.nrg.xnat.client.rest.WSTool.<init>(WSTool.java:64)
    at org.nrg.xnat.client.rest.XNATRestClient.<init>(XNATRestClient.java:49)
    at org.nrg.xnat.client.rest.XNATRestClient.main(XNATRestClient.java:303)

I have verified several times and it is not a tomcat user problem (since tomcat is run by the same user that has access to everything, and not root!) and even more, I check xnat-rest-client.log file in $TOMCAT_HOME/webapps/xnat/logs and the file is there, with all the good permissions but empty.

Has anybody bump into this before?
What could I do to solve this?

Thank you very much

Herrick, Rick

unread,
Sep 24, 2015, 1:07:54 PM9/24/15
to xnat_di...@googlegroups.com
Can you try using XnatDataClient instead of XNATRestClient?

That said, this is pretty clearly a permissions issue that’s being encountered down at the Java level. Can you su to the tomcat user and try editing a file in that folder? Something like this would probably tell you what you need to know:

root@xnatdev:/var/lib/tomcat7/webapps/xnat# su - xnat -c "cp /var/lib/tomcat7/webapps/xnat/favicon.ico /var/log/nginx"
cp: cannot create regular file ‘/var/log/nginx/favicon.ico’: Permission denied

This shows that the tomcat user (in this case, I have Tomcat 7 running under the user xnat) can’t write into the folder /var/log/nginx.

-- 

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.

Elijah Rockers

unread,
Apr 20, 2017, 12:33:22 PM4/20/17
to xnat_discussion
I'm having this same issue. I upgraded some software (to Freesurfer 6) and now XNATRestClient is broken in the pipeline. Where is that log file located? I don't have anything related in /var/log

Running /xnat/pipeline/xnat-tools/XNATRestClient with no arguments gives my personal user an error. However if I switch to tomcat, I don't see that error. But if I run "ps -feww" I can see:

tomcat    1997     1  1 09:21 ?        00:01:45 /xnat/jdk1.7.0_79/bin/java -Djava.util.logging.config.file=/xnat/apache-tomcat-7.0.72/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms1024m -Xmx2048m -XX:MaxPermSize=1024m -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/xnat/apache-tomcat-7.0.72/endorsed -classpath /xnat/apache-tomcat-7.0.72/bin/bootstrap.jar:/xnat/apache-tomcat-7.0.72/bin/tomcat-juli.jar -Dcatalina.base=/xnat/apache-tomcat-7.0.72 -Dcatalina.home=/xnat/apache-tomcat-7.0.72 -Djava.io.tmpdir=/xnat/apache-tomcat-7.0.72/temp org.apache.catalina.startup.Bootstrap start

Which suggests to me that the tomcat application was started by the tomcat user (in this case, "tomcat") So I'm not sure why during the the pipeline it is getting that error.

Also, if I want to switch to using XnatDataClient, is the syntax the same? i.e., can I just replace XNATRestClient?

Elijah Rockers

unread,
Apr 20, 2017, 1:05:14 PM4/20/17
to xnat_discussion
Whoops, nevermind. Turns out the hippocampal subfield segmentation argument was giving a deprecation error that didn't appear in the error log (went to stdout log instead).

The REST calls actually seem to be working fine.

The error log still has the xnat-rest-client.log permission denied error though. Not a big deal as long as my pipeline works,

John Flavin

unread,
Apr 20, 2017, 1:53:14 PM4/20/17
to xnat_discussion
For future reference, it is easy to swap out XNATRestClient for XnatDataClient in your pipelines. The parameters are not 100% the same, but if you look at the resource descriptors (catalog/xnat_tools/XnatDataClient.xml and catalog/xnat_tools/XnatRestClient.xml, respectively) you should be able to see how to switch the params over. For instance, XNATRestClient splits the URL into two arguments which in the pipeline you would call "host" and "remote", whereas XnatDataClient just puts the whole URL in one argument that the pipeline would call "remote". Does not take long to do.

Flavin

Reply all
Reply to author
Forward
0 new messages