关于创建Web服务客户端的NoSuchMethodError

时间:2012-05-06 01:00:48

标签: java axis2 webservice-client nosuchmethoderror

我是java和Web服务的新手,axis2。我最近使用一些教程创建了一个Web服务。当我第一次按照eclipse教程时,让我创建一个客户端。但是当我尝试创建一个新项目和一个新的Web服务客户端时,它会提供NoSuchMethodError。这看起来像这样:

  

WSDL代码生成时发生异常:   java.lang.NoSuchMethodError:   javax.wsdl.Operation.getExtensionAttributes()Ljava / util的/地图;       java.lang.reflect.InvocationTargetException       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)       at java.lang.reflect.Method.invoke(Unknown Source)       在org.eclipse.jst.ws.axis2.consumption.core.utils.WSDL2JavaGenerator.getAxisService(WSDL2JavaGenerator.java:379)       在org.eclipse.jst.ws.axis2.consumption.core.command.Axis2ClientCodegenCommand.execute(Axis2ClientCodegenCommand.java:94)       在org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)       在org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)       在org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)       在org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager $ 6.run(SimpleCommandEngineManager.java:294)       at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)       在org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)       在org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)       在org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)       在org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)       在org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(WizardPageManager.java:262)       在org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(DynamicWizard.java:380)       在org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)       在org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)       在org.eclipse.jface.dialogs.Dialog $ 2.widgetSelected(Dialog.java:618)       at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)       在org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)       在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)       在org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)       在org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)       在org.eclipse.jface.window.Window.runEventLoop(Window.java:820)       在org.eclipse.jface.window.Window.open(Window.java:796)       在org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)       在org.eclipse.jface.action.Action.runWithEvent(Action.java:498)       at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)       at org.eclipse.jface.action.ActionContributionItem.access $ 2(ActionContributionItem.java:490)       at org.eclipse.jface.action.ActionContributionItem $ 5.handleEvent(ActionContributionItem.java:402)       在org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)       在org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)       在org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)       在org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)       在org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)       在org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)       在org.eclipse.ui.internal.Workbench.access $ 4(Workbench.java:2219)       在org.eclipse.ui.internal.Workbench $ 4.run(Workbench.java:466)       在org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)       在org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)       在org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)       在org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)       在org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)       在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)       在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)       在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)       在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)       at java.lang.reflect.Method.invoke(Unknown Source)       在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)       在org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)       在org.eclipse.equinox.launcher.Main.run(Main.java:1173)       引起:java.lang.NoSuchMethodError:javax.wsdl.Operation.getExtensionAttributes()Ljava / util / Map;       在org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateOperations(WSDL11ToAxisServiceBuilder.java:1427)       at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populatePortType(WSDL11ToAxisServiceBuilder.java:606)       at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpoints(WSDL11ToAxisServiceBuilder.java:483)       在org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:373)       ......还有56个

即时使用axis2-1.6.1,它表示java合规级别为6 我搜索了它,但无法找到解决此问题的相关解决方案。 任何帮助表示赞赏。

3 个答案:

答案 0 :(得分:1)

我遇到了同样的问题并通过查看我的 WEB-INF / lib 解决了这个问题。
我的 WEB-INF 中有两个 AXIS2 jar文件。
如果将来自两个不同版本的axis2的jar文件复制到 WEB-INF ,也会发生这种情况。

希望它有效: - )

答案 1 :(得分:0)

问题是Eclipse"找不到东西"。

这是一个例子;这里的解决方案是:

  1. 确保项目中包含所有必需的.jar库

  2. 选择"首先搜索本地课程"在进行部署时加载类

  3. Error in AXIS2 when i try publish ODI web services

答案 2 :(得分:0)

请按照以下说明操作。

  1. 确保您的Web服务在服务器中可用。请通过查看您的Web服务的WSDL来检查它。
  2. 之后按照其中一篇文章的说明进行操作
  3. web-service-client-using-eclipse-axis2
    BottomUpAxis2WebService

    它对我很好。确保为eclipse正确安装了code-gen插件。