0

I'm new to java and web services and axis2. I recently created a web service using some tutorials. When I first follow the tutorial eclipse let me create a client. But when I try to create a new project and a new web service client it gives NoSuchMethodError. Which exactly looks like this:

Exception occurred while code generation for WSDL : java.lang.NoSuchMethodError: javax.wsdl.Operation.getExtensionAttributes()Ljava/util/Map; 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) at org.eclipse.jst.ws.axis2.consumption.core.utils.WSDL2JavaGenerator.getAxisService(WSDL2JavaGenerator.java:379) at org.eclipse.jst.ws.axis2.consumption.core.command.Axis2ClientCodegenCommand.execute(Axis2ClientCodegenCommand.java:94) at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419) at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359) at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254) at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934) at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264) at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91) at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(WizardPageManager.java:262) at org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(DynamicWizard.java:380) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182) at 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) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at 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) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447) at org.eclipse.equinox.launcher.Main.run(Main.java:1173) Caused by: java.lang.NoSuchMethodError: javax.wsdl.Operation.getExtensionAttributes()Ljava/util/Map; at 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) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:373) ... 56 more

im using axis2-1.6.1 and it says java compliance level is 6 I googled it but couldn't find a relevant solution to this problem. Any help is appreciated.

Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
bliss
  • 330
  • 3
  • 14

3 Answers3

1

I had the same problem and solved it by checking out my WEB-INF/lib.
I had two of any AXIS2 jar files in my WEB-INF.
It also happens if jar files from two different versions of axis2 were copied to WEB-INF.

Hope it works :-)

Arash moradabadi
  • 230
  • 1
  • 12
0

The problem is that Eclipse "isn't finding something".

Here's one example; the solution here was to:

  1. Make sure all necessary .jar libraries were included in the project

  2. Select "search local classes first" in Class loading when doing a deploy

Error in AXIS2 when i try publish ODI web services

Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • i've already looked at this and since i'm really new to java, i couldn't find the "missing library", and also when i first created the service it didn't complain – bliss May 06 '12 at 01:10
  • Luiggi Mendoza's comment about "@WebService" annotation is good advice - please double-check it. And Java is case-sensitive: method "myMethod()" and method "MyMethod()" are *two different things*. If you accidentally typed one - but meant the other - the program will compile ... but might fail with a "NoSuchMethod" error at runtime. – paulsm4 May 06 '12 at 02:22
  • i don't know where to check "@WebService" and the thing is i couldn't create a client so i couldn't call any function anywhere. the problem comes when i'm trying to create it. not when im calling something – bliss May 06 '12 at 10:35
0

Please follow the following instructions.

  1. Make Sure Your Web Service is Available in the Server. Please check it by viewing the WSDL of you web service.
  2. After that follow the instructions on one of these articles,

web-service-client-using-eclipse-axis2
BottomUpAxis2WebService

It works for me fine. Make sure that your code-gen plug-in is properly installed for eclipse.

Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
andunslg
  • 781
  • 14
  • 38