2012-05-29 57 views
1

我正在嘗試創建一個示例axis2 ServiceClient。投擲錯誤以下嘗試執行axis2服務客戶端時發生異常

org.apache.axiom.om.OMException: No meta factory found for feature 'default'; this usually means that axiom-impl.jar is not in the classpath 
    at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:170) 
    at org.apache.axiom.om.OMAbstractFactory.getMetaFactory(OMAbstractFactory.java:135) 
    at org.apache.axiom.om.OMAbstractFactory.getOMFactory(OMAbstractFactory.java:184) 
    at org.apache.axis2.description.AxisDescription.<init>(AxisDescription.java:68) 
    at org.apache.axis2.engine.AxisConfiguration.<init>(AxisConfiguration.java:148) 
    at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:639) 
    at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116) 
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68) 
    at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184) 
    at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150) 
    at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143) 
    at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:244) 
    at org.apache.axis2.samples.tu.client.TUrlSOAPClient.addUrl(TUrlSOAPClient.java:46) 
    at org.apache.axis2.samples.tu.client.TUrlClient.actionPerformed(TUrlClient.java:69) 
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) 
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) 
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) 
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source) 
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) 
    at java.awt.Component.processMouseEvent(Unknown Source) 
    at javax.swing.JComponent.processMouseEvent(Unknown Source) 
    at java.awt.Component.processEvent(Unknown Source) 
    at java.awt.Container.processEvent(Unknown Source) 
    at java.awt.Component.dispatchEventImpl(Unknown Source) 
    at java.awt.Container.dispatchEventImpl(Unknown Source) 
    at java.awt.Component.dispatchEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) 
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) 
    at java.awt.Container.dispatchEventImpl(Unknown Source) 
    at java.awt.Window.dispatchEventImpl(Unknown Source) 
    at java.awt.Component.dispatchEvent(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 

axiom-impl.jar存在於類路徑中。以下是代碼片段。在控制檯中,我可以看到sysout語句「Entered」顯示,然後在ServiceClient對象創建時拋出錯誤。已嘗試使用不同版本的axiom-impl.jar(1.2.12,1.2.13,1.2.7,1.2.5),但仍然出現相同的錯誤。

 public static String testFunction(String testData) throws Exception { 
    System.out.println("Entered"); 
    //Create a service client 
    ServiceClient client = new ServiceClient(); 
    System.out.println("Before calling set end point"); 
    //Set the endpoint address 
    client.getOptions().setTo(new EndpointReference(EPR)); 
    System.out.println("After calling set end point"); 
    System.out.println("getPayload(url)="+getPayload(testData)); 
    //Make the reqest and get the response 
    OMElement resp = client.sendReceive(getPayload(testData)); 
    //Extract the URL and return 
    return extractUrl(resp); 
} 

回答

2

由剛剛更換所有的三個獨立的公理罐(公理IMPL-1.2.13.jar,公理-DOM-1.2.13.jar和公理-API 1.2.13.jar)解決了這個axiom.jar。

+0

但爲什麼會發生這種情況,我仍然爲此得到答案有一些設置我們在eclipse或tomcat中要求最新版本的axim jar。 – Vipin

+0

出於某種原因,我也遇到了同樣的情況,但我仍無法找出導致此問題的原因。無論如何,謝謝你,你救了我的一天。 –

1

當我使用上面的jar我得到了另一個錯誤。 java.lang.ClassCastException:java.lang.ClassCastException:org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory

我不得不加大版的每個瓶子

0

我的1.2.14同樣的錯誤。我只是用axiom.jar替換了各個公理瓶(axiom-impl-1.2.13.jar,axiom-dom-1.2.13.jar和axiom-api-1.2.13.jar),但錯誤仍在發生。

錯誤的根本原因是META-INF/axiom.xml文件的位置。就我而言,J2EE服務器容器的XMLParser在本地化爲jar文件時無法打開axion.xml文件。

我不得不將META-INF/axiom.xml複製到WEB-INF/classes/META-INF/axiom.xml中。

1

我有相同的錯誤,但最終通過使用公理-API 1.2.12和公理-PIL 1.2.12經過長時間的鬥爭終於得到解決。

相關問題