Apache DecoderException using XNATRestClient

121 views
Skip to first unread message

Sanket Gupte

unread,
Mar 2, 2012, 11:13:04 AM3/2/12
to xnat_di...@googlegroups.com
Hi,
I am trying to use XNATRestClient from the command prompt and it is giving this ::
org/apache/commons/codec/DecoderException.
Error logged in /some/path/xnat/bin/error.log

The following are the contents of error.log

Fri Mar 02 16:08:48 EST 2012 guptesanket@http://central.xnat.org/:java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
        at org.apache.commons.httpclient.methods.ExpectContinueMethod.<init>(ExpectContinueMethod.java:93)
        at org.apache.commons.httpclient.methods.EntityEnclosingMethod.<init>(EntityEnclosingMethod.java:119)
        at org.apache.commons.httpclient.methods.PutMethod.<init>(PutMethod.java:76)
        at XNATRestClient.execute(XNATRestClient.java:195)
        at XNATRestClient.process(XNATRestClient.java:100)
        at WSTool.perform(WSTool.java:130)
        at XNATRestClient.main(XNATRestClient.java:296)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        ... 8 more

i tried it on my Xnat installation and got this error, so tried it on xnat Central but ended up getting the same error.
I can GET results from the browser.

What could I be doing wrong  here? Any suggestions? What class definition is it looking for?
Thanks in advance :)

Rick Herrick

unread,
Aug 13, 2012, 6:22:19 PM8/13/12
to xnat_di...@googlegroups.com
Hey Sanket,

Sorry this issue slipped by the wayside, but we do have it in our issue tracker and I just came across it again. The problem is that the XNATRestClient script is not getting generated with a classpath, which it requires.

The fix for this is add the classpath to the script:

java -jar xnat_builder/lib/xdat-restClient-1.jar -cp  xnat_builder/lib/commons-httpclient-3.1.jar: xnat_builder/lib/commons-codec-1.5.jar $@

xnat_builder should actually be the fully qualified local path to your xnat_builder installation.

The same resolution will work on Windows with the appropriately formatted path.

We'll have a fix for this in 1.6.1; actually, we'll probably have a fix for this in the development fork relatively soon. I have a note on the bug to send out a response to this thread when the changeset has been committed.

Evan Haas

unread,
Aug 14, 2012, 2:24:23 PM8/14/12
to xnat_di...@googlegroups.com
Sanket,

As it turns out, there is a classpath specified in the manifest of xdat-restClient-1.jar.  When this is done, any classpath given on the command line is ignored (http://stackoverflow.com/a/1708743/612265).

We've fixed the JAR manifest and this will be part of 1.6.1.  If you'd like to try it sooner, you can pull the following changeset:

https://bitbucket.org/nrg/xnat_builder_1_6dev/changeset/91a8f3b8084c3f3bf32f4e09d43839f8f35069ea

After you pull, you'll need to either run the update script, or manually copy the new jar from xnat_builder/plugin-resources/repository/xdat/jars into xnat_builder/lib.

Evan
Reply all
Reply to author
Forward
Message has been deleted
0 new messages