aspose file tools*
The moose likes Web Services and the fly likes Axis2 NoSuchMethodError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis2 NoSuchMethodError" Watch "Axis2 NoSuchMethodError" New topic
Author

Axis2 NoSuchMethodError

Remi Desreumaux
Greenhorn

Joined: Sep 23, 2010
Posts: 19
Hello, I am kind of surprised of this mistake.

Following this tutorial: http://www.tidytutorials.com/2009/02/web-services-example-using-axis-2-and.html, I block at the client execution.



The function is called here into the axis2-kernel-1.5.1.jar package, we can successfully find org.apache.axis2.client, Stub.class and its method addAnonymousOperations().

http://img695.imageshack.us/img695/4306/preuvez.jpg
http://img695.imageshack.us/i/preuvez.jpg

Into my AXISCLASSPATH, I got axis2-kernel-1.5.1.jar included...

C:\remi\dev\Axis2TomcatHelloworldold\client_bin>echo %AXISCLASSPATH%
C:\remi\dev\ws\axis2-1.5.1\lib\wsdl4j-1.6.2.jar;C:\remi\dev\ws\axis2-1.5.1\lib\a
xis.jar;C:\remi\dev\ws\axis2-1.5.1\lib\commons-discovery-0.2.jar;C:\remi\dev\ws\
axis2-1.5.1\lib\commons-logging-1.1.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\jaxrpc.
jar;C:\remi\dev\ws\axis2-1.5.1\lib\saaj.jar;C:\remi\dev\ws\axis2-1.5.1\lib\log4j
-1.2.15.jar;C:\remi\dev\ws\axis2-1.5.1\lib\xml-apis-1.3.02.jar;C:\remi\dev\ws\ax
is2-1.5.1\lib\xercesImpl-2.6.6.jar;C:\axis2-1.1.1.jar;C:\remi\dev\ws\axis2-1.5.1
\lib\axis2-adb-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-adb-codegen-1.5.1.
jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-ant-plugin-1.5.1.jar;C:\remi\dev\ws\axi
s2-1.5.1\lib\axis2-clustering-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-cod
egen-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-corba-1.5.1.jar;C:\remi\dev\
ws\axis2-1.5.1\lib\axis2-fastinfoset-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\ax
is2-java2wsdl-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-jaxws-1.5.1.jar;C:\
remi\dev\ws\axis2-1.5.1\lib\axis2-jaxbri-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\li
b\axis2-jaxws-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-jibx-1.5.1.jar;C:\r
emi\dev\ws\axis2-1.5.1\lib\axis2-json-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\a
xis2-kernel-1.5.1.jar
;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-metadata-1.5.1.jar;C:
\remi\dev\ws\axis2-1.5.1\lib\axis2-mtompolicy-1.5.1.jar;C:\remi\dev\ws\axis2-1.5
.1\lib\axis2-saaj-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-spring-1.5.1.ja
r;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-transport-http-1.5.1.jar;C:\remi\dev\ws\a
xis2-1.5.1\lib\axis2-transport-local-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\ax
is2-xmlbeans-1.5.1.jar;C:\axiom.jar;C:\XmlSchema-1.4.6.jar

How can I think this ? thanks for help
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Read the error message carefully: the class that's missing the addAnonymousOperations method is not Stub, but helloworld.Axis2TomcathelloworldStub.
Amit ChaudhariC
Ranch Hand

Joined: Aug 06, 2009
Posts: 33
Hi,

Also , check the echo command output and the command by which you are running the client.

Please check whether D:\downloads\axis2-1.4.1-bin\axis2-1.4.1\lib exists? as i can see the echo command points to a diff axis path altogether.

Regards,
Amit
Remi Desreumaux
Greenhorn

Joined: Sep 23, 2010
Posts: 19
I know but despite that the function is called from helloworld.Axis2TomcathelloworldStub, it makes reference to an other class in a library.
Look at the code of helloworld.Axis2TomcathelloworldStub here : (in client_src)

http://codediaries.com/code/examples/Axis2TomcatHelloWorld.zip


Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The helloworld.Axis2TomcathelloworldStub class you posted neither has nor calls the addAnonymousOperations method. Somewhere you have mismatched class and/or library files (as is invariably the case when encountering NoSuchMethodError). Start by deleting all your class files and recompiling them. Make sure you're using the same Axis version for creating the stubs, compiling your code, and running your code (from your post it looks like you're mixing Axis2 1.4.1 and Axis2 1.5.1 - you can't do that).
Amit ChaudhariC
Ranch Hand

Joined: Aug 06, 2009
Posts: 33
Hi Remi,

I see no issues with the code .
I am sure the classpath and using proper versions for compiling and running the code with solve your issues.
To set the classpath correctly i suggest you refer the script provided under AXIS2_HOME/bin

Also in the classpath you mentioned , please check the section in the bold.

C:\remi\dev\Axis2TomcatHelloworldold\client_bin>echo %AXISCLASSPATH%
C:\remi\dev\ws\axis2-1.5.1\lib\wsdl4j-1.6.2.jar;C:\remi\dev\ws\axis2-1.5.1\lib\a
xis.jar;C:\remi\dev\ws\axis2-1.5.1\lib\commons-discovery-0.2.jar;C:\remi\dev\ws\
axis2-1.5.1\lib\commons-logging-1.1.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\jaxrpc.
jar;C:\remi\dev\ws\axis2-1.5.1\lib\saaj.jar;C:\remi\dev\ws\axis2-1.5.1\lib\log4j
-1.2.15.jar;C:\remi\dev\ws\axis2-1.5.1\lib\xml-apis-1.3.02.jar;C:\remi\dev\ws\ax
is2-1.5.1\lib\xercesImpl-2.6.6.jar;C:\axis2-1.1.1.jar;C:\remi\dev\ws\axis2-1.5.1
\lib\axis2-adb-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-adb-codegen-1.5.1.
jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-ant-plugin-1.5.1.jar;C:\remi\dev\ws\axi
s2-1.5.1\lib\axis2-clustering-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-cod
egen-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-corba-1.5.1.jar;C:\remi\dev\
ws\axis2-1.5.1\lib\axis2-fastinfoset-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\ax
is2-java2wsdl-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-jaxws-1.5.1.jar;C:\
remi\dev\ws\axis2-1.5.1\lib\axis2-jaxbri-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\li
b\axis2-jaxws-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-jibx-1.5.1.jar;C:\r
emi\dev\ws\axis2-1.5.1\lib\axis2-json-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\a
xis2-kernel-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-metadata-1.5.1.jar;C:
\remi\dev\ws\axis2-1.5.1\lib\axis2-mtompolicy-1.5.1.jar;C:\remi\dev\ws\axis2-1.5
.1\lib\axis2-saaj-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-spring-1.5.1.ja
r;C:\remi\dev\ws\axis2-1.5.1\lib\axis2-transport-http-1.5.1.jar;C:\remi\dev\ws\a
xis2-1.5.1\lib\axis2-transport-local-1.5.1.jar;C:\remi\dev\ws\axis2-1.5.1\lib\ax
is2-xmlbeans-1.5.1.jar;C:\axiom.jar;C:\XmlSchema-1.4.6.jar

Regards,
Amit
Remi Desreumaux
Greenhorn

Joined: Sep 23, 2010
Posts: 19
it is better but still something wrong :
thank you guys.






Alternative

http://127.0.0.1:8181/axis2/services/axis2tomcathelloworld.axis2tomcathelloworldHttpSoap12Endpoint/

<soapenv:Reason>

<soapenv:Text xml:lang="en-US">
The service cannot be found for the endpoint reference (EPR) /axis2/services/axis2tomcathelloworld.axis2tomcathelloworldHttpSoap12Endpoint/
</soapenv:Text>
</soapenv:Reason>



and if I do that :

original Axis2TomcathelloworldStub stub = new Axis2TomcathelloworldStub();
modified Axis2TomcathelloworldStub stub =
new Axis2TomcathelloworldStub("http://127.0.0.1:8081/axis2/services/axis2tomcathelloworld.axis2tomcathelloworldHttpSoap12Endpoint/");


and execution :


To me it does not sound that bad cause i se the xml response in my client but I dont hace what it is expected, namely hello back as the tuto said.




Remi Desreumaux
Greenhorn

Joined: Sep 23, 2010
Posts: 19
I guess it works ! thank you so much
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Axis2 NoSuchMethodError