尝试执行axis2服务客户端时获取异常 [英] Getting Exception while trying to execute axis2 service client

查看:257
本文介绍了尝试执行axis2服务客户端时获取异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建示例axis2 ServiceClient.它抛出错误以下

I am trying to create a sample axis2 ServiceClient. It is throwing below error

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),但仍然遇到相同的错误.

The axiom-impl.jar is present in the classpath. Below is the code snippet. In the console I can see that sysout statement "Entered" is displayed, after that its throwing error at ServiceClient object creation. Have tried using different versions of the axiom-impl.jar (1.2.12, 1.2.13, 1.2.7, 1.2.5) but still getting the same error.

     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);
}

推荐答案

通过替换所有三个单独的公理罐(axiom-impl-1.2.13.jar,axiom-dom-1.2.13.jar和axiom- api-1.2.13.jar).

Solved this by replacing all the three individual axiom jars( axiom-impl-1.2.13.jar, axiom-dom-1.2.13.jar and axiom-api-1.2.13.jar) by just axiom.jar.

这篇关于尝试执行axis2服务客户端时获取异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆