2012-08-07 31 views
0

下面是代碼:SAXBuilder的JDOM給人異常

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的實例化這給了我的InvocationTargetException錯誤。

任何人都有過這個?看起來像這應該工作。

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) 
+0

向我們展示堆棧跟蹤。而xml輸入可能也有幫助。 – 2012-08-07 22:30:10

+0

我添加了日誌,但SAXBuilder包在構建路徑 – rpfujiw 2012-08-07 22:38:29

回答

1

我要去這裏走出去的肢體和說,雖然SAXBuilder可能在你的構建路徑,這是不是你的運行路徑上。

+0

該jar在我的構建路徑中,我使用的是Eclipse我不確定我知道你的意思是由runpath? – rpfujiw 2012-08-07 23:03:46

+0

下載最新的jdom.jar。如果您從您構建的同一個項目運行,則應該已經設置了依賴關係。檢查運行配置...->類路徑以查找失敗的運行配置。 – Reimeus 2012-08-07 23:42:21

+0

這是一個非常堅實的肢體,methinks :) – 2012-08-08 00:43:20