这是代码:
Representation representation = representItem(exp.getItem(),MediaType.TEXT_XML);
Document doc = new SAXBuilder().build(representation.getStream());
XPath xpath = XPath.newInstance("/xnat:MRSession/xnat:scan/xnat:file");
当实例化 SAXBuilder 时,这会给我一个 InitationTargetException 错误。
有人以前有过这个吗?看起来这应该可行。
2012-08-07 17:17:58,441 [http-8080-1] ERROR org.restlet.XNATVirtualHost.XNATApplication - Unhandled exception or error intercepted
java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
at org.nrg.xnat.restlet.actions.SessionCopy.<init>(SessionCopy.java:98)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
最佳答案
我要冒险地说出这句话 SAXBuilder可能在您的构建路径中,但不在您的运行路径中。
关于java - SAXBuilder jdom 给出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11855014/