You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Stadelmann Josef <jo...@axa-winterthur.ch> on 2012/04/02 17:51:57 UTC
[axis2-1.6.1] jaxws-samples - SampleClient.java not running
OK - it compiles correct and the services have been tested using the JSP
GUI.
So it is time to take the SampleClient.java code and take a debugg
session to learn what all will happen.
BUG: running SampleClient.java results in
cd E:\Users\C770817\SW-UMGEBUNG\axis2-1.6.1\samples\jaxws-samples;
"JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_30"
E:\\Users\\C770817\\SW-UMGEBUNG\\apache-maven-3.0.5\\bin\\mvn.bat
"-Dexec.args=-classpath %classpath
org.apache.axis2.jaxws.samples.client.SampleClient"
-Dexec.executable=java -Dexec.classpathScope=runtime process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec
Scanning for projects...
------------------------------------------------------------------------
Building JAXWS Samples - Echo, Ping, MTOM 1.6.1
------------------------------------------------------------------------
[resources:resources]
[debug] execute contextualize
Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
Copying 0 resource
[compiler:compile]
File encoding has not been set, using platform encoding Cp1252, i.e.
build is platform dependent!
Compiling 1 source file to
E:\Users\C770817\SW-UMGEBUNG\axis2-1.6.1\samples\jaxws-samples\target\cl
asses
[exec:exec]
Exception in thread "main" java.lang.RuntimeException: Please set
org.apache.axis2.jaxws.config.path system property to a valid axis2.xml
file (with addressing module enabled)
at
org.apache.axis2.jaxws.samples.client.SampleClient.initConfigurationFact
ory(SampleClient.java:249)
at
org.apache.axis2.jaxws.samples.client.SampleClient.CallService(SampleCli
ent.java:230)
at
org.apache.axis2.jaxws.samples.client.SampleClient.main(SampleClient.jav
a:78)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.200s
Finished at: Mon Apr 02 14:50:20 CEST 2012
Final Memory: 14M/495M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec
(default-cli) on project jaxws-samples: Command execution failed.
Process exited with an error: 1(Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e
switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please
read the following articles:
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
'cmd' is not recognized as an internal or external command,
operable program or batch file.
OK - let's add a fix and
public static void main(String[] args) {
System.setProperty("org.apache.axis2.jaxws.config.path",
"/E:/Users/C770817/SW-UMGEBUNG/axis2-1.6.1/repository/axis2.xml");
SampleClient sample = new SampleClient();
sample.parseArgs(args);
sample.CallService();
}
OK ? - Let us try again to run this SampleClient
cd E:\Users\C770817\SW-UMGEBUNG\axis2-1.6.1\samples\jaxws-samples;
"JAVA_HOME=C:\\Program Files\\Java\\jdk1.6.0_30"
E:\\Users\\C770817\\SW-UMGEBUNG\\apache-maven-3.0.5\\bin\\mvn.bat
"-Dexec.args=-classpath %classpath
org.apache.axis2.jaxws.samples.client.SampleClient"
-Dexec.executable=java -Dexec.classpathScope=runtime process-classes
org.codehaus.mojo:exec-maven-plugin:1.2:exec
Scanning for projects...
------------------------------------------------------------------------
Building JAXWS Samples - Echo, Ping, MTOM 1.6.1
------------------------------------------------------------------------
[resources:resources]
[debug] execute contextualize
Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
Copying 0 resource
[compiler:compile]
File encoding has not been set, using platform encoding Cp1252, i.e.
build is platform dependent!
Compiling 1 source file to
E:\Users\C770817\SW-UMGEBUNG\axis2-1.6.1\samples\jaxws-samples\target\cl
asses
[exec:exec]
02.04.2012 14:54:25 org.apache.axis2.deployment.ClusterBuilder
buildCluster
INFO: Clustering has been disabled
02.04.2012 14:54:25 org.apache.axis2.deployment.DeploymentEngine
loadFromClassPath
INFO: Module validation failed: The system is attempting to engage a
module that is not available: addressing
Exception in thread "main" javax.xml.ws.WebServiceException: Error
getting Client Configuration Context : The system is attempting to
engage a module that is not available: addressing
at
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(Except
ionFactory.java:173)
at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(Exceptio
nFactory.java:70)
at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(Exceptio
nFactory.java:118)
at
org.apache.axis2.jaxws.ClientConfigurationFactory.<init>(ClientConfigura
tionFactory.java:60)
at
org.apache.axis2.jaxws.samples.client.SampleClient.initConfigurationFact
ory(SampleClient.java:254)
at
org.apache.axis2.jaxws.samples.client.SampleClient.CallService(SampleCli
ent.java:230)
at
org.apache.axis2.jaxws.samples.client.SampleClient.main(SampleClient.jav
a:78)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.761s
Finished at: Mon Apr 02 14:54:25 CEST 2012
Final Memory: 11M/495M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec
(default-cli) on project jaxws-samples: Command execution failed.
Process exited with an error: 1(Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e
switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please
read the following articles:
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
'cmd' is not recognized as an internal or external command,
operable program or batch file.
BAD - lets us add a client repository path with just client side
axis2.xml in it and a modul directory with just addressing in it and an
empty service directory.
BUT - to make SampleClient aware of that a code change it is required to
add axis2.xml and axis2.repo as System.properties
OK ? - Let us try again to run this SampleClient
[exec:exec]
02.04.2012 15:07:21 org.apache.axis2.deployment.ClusterBuilder
buildCluster
INFO: Clustering has been disabled
02.04.2012 15:07:21 org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: addressing-1.6.1 -
file:/E:/Users/C770817/SW-UMGEBUNG/axis2-1.6.1/repository-client/modules
/addressing-1.6.1.mar
02.04.2012 15:07:21
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator
generateWsdl
SCHWERWIEGEND: Error occurred generating WSDL file for Web service
implementation class
{org.apache.axis2.jaxws.samples.client.echo.EchoServicePortTypeClient}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generate
Wsdl(JAXWSRIWSDLGenerator.java:184)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initiali
ze(JAXWSRIWSDLGenerator.java:390)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(
JAXWSRIWSDLGenerator.java:383)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.buildAxi
sServiceFromGeneratedWSDL(EndpointDescriptionImpl.java:1054)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.setupAxi
sService(EndpointDescriptionImpl.java:778)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(E
ndpointDescriptionImpl.java:276)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(E
ndpointDescriptionImpl.java:224)
at
org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.updateEnd
pointDescription(ServiceDescriptionImpl.java:534)
at
org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.updateEnd
point(DescriptionFactoryImpl.java:364)
at
org.apache.axis2.jaxws.description.DescriptionFactory.updateEndpoint(Des
criptionFactory.java:180)
at
org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:
597)
at
org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:
513)
at javax.xml.ws.Service.getPort(Service.java:92)
at
org.apache.axis2.jaxws.samples.client.echo.EchoService.getEchoServicePor
t(EchoService.java:58)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy$Descript
or.initCommon(EchoServicePortProxy.java:54)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy$Descript
or.<init>(EchoServicePortProxy.java:50)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy.<init>(E
choServicePortProxy.java:96)
at
org.apache.axis2.jaxws.samples.client.SampleClient.buildAsync(SampleClie
nt.java:368)
at
org.apache.axis2.jaxws.samples.client.SampleClient.CallService(SampleCli
ent.java:234)
at
org.apache.axis2.jaxws.samples.client.SampleClient.main(SampleClient.jav
a:81)
Caused by: java.lang.NoClassDefFoundError:
com/sun/mirror/apt/AnnotationProcessorFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactor
yImpl.java:60)
at
com.sun.tools.ws.spi.WSToolsObjectFactory.wsgen(WSToolsObjectFactory.jav
a:107)
... 24 more
Caused by: java.lang.ClassNotFoundException:
com.sun.mirror.apt.AnnotationProcessorFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.load>> CLIENT: ERROR: SEI
Async EXCEPTION.
Class(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 38 more
javax.xml.ws.WebServiceException: Error occurred generating WSDL file
for Web service implementation class
{org.apache.axis2.jaxws.samples.client.echo.EchoServicePortTypeClient}
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generate
Wsdl(JAXWSRIWSDLGenerator.java:198)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initiali
ze(JAXWSRIWSDLGenerator.java:390)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(
JAXWSRIWSDLGenerator.java:383)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.buildAxi
sServiceFromGeneratedWSDL(EndpointDescriptionImpl.java:1054)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.setupAxi
sService(EndpointDescriptionImpl.java:778)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(E
ndpointDescriptionImpl.java:276)
at
org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.<init>(E
ndpointDescriptionImpl.java:224)
at
org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.updateEnd
pointDescription(ServiceDescriptionImpl.java:534)
at
org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.updateEnd
point(DescriptionFactoryImpl.java:364)
at
org.apache.axis2.jaxws.description.DescriptionFactory.updateEndpoint(Des
criptionFactory.java:180)
at
org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:
597)
at
org.apache.axis2.jaxws.spi.ServiceDelegate.getPort(ServiceDelegate.java:
513)
at javax.xml.ws.Service.getPort(Service.java:92)
at
org.apache.axis2.jaxws.samples.client.echo.EchoService.getEchoServicePor
t(EchoService.java:58)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy$Descript
or.initCommon(EchoServicePortProxy.java:54)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy$Descript
or.<init>(EchoServicePortProxy.java:50)
at
org.apache.axis2.jaxws.samples.client.echo.EchoServicePortProxy.<init>(E
choServicePortProxy.java:96)
at
org.apache.axis2.jaxws.samples.client.SampleClient.buildAsync(SampleClie
nt.java:368)
at
org.apache.axis2.jaxws.samples.client.SampleClient.CallService(SampleCli
ent.java:234)
at
org.apache.axis2.jaxws.samples.client.SampleClient.main(SampleClient.jav
a:81)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generate
Wsdl(JAXWSRIWSDLGenerator.java:184)
... 19 more
Caused by: java.lang.NoClassDefFoundError:
com/sun/mirror/apt/AnnotationProcessorFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
com.sun.tools.ws.util.WSToolsObjectFactoryImpl.wsgen(WSToolsObjectFactor
yImpl.java:60)
at
com.sun.tools.ws.spi.WSToolsObjectFactory.wsgen(WSToolsObjectFactory.jav
a:107)
... 24 more
Caused by: java.lang.ClassNotFoundException:
com.sun.mirror.apt.AnnotationProcessorFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 38 more
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
What is missing here ? which jar has the AnnotationProcessorFactory?
OK - I then check the jaxws-samples directory structure and I can fin
"org.apache.axis2.jaxws.samples.client.echo"
and in that package I can find the " EchoServicePortTypeClient.java"
The brown stack text happens when <parameter
name="useGeneratedWSDLinJAXWS">true</parameter>
OK - lets have the axis2.xml of the client, changed it back to its
default that the wsdl is generated from @annotations!
With this parameter set false (the default) <parameter
name="useGeneratedWSDLinJAXWS">false</parameter>
the client sample run but the client reports an Connection exception
The result is:
------------------------------------------------------------------------
Building JAXWS Samples - Echo, Ping, MTOM 1.6.1
------------------------------------------------------------------------
[resources:resources]
[debug] execute contextualize
Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
Copying 0 resource
[compiler:compile]
Nothing to compile - all classes are up to date
[exec:exec]
02.04.2012 16:42:18 org.apache.axis2.deployment.ClusterBuilder
buildCluster
INFO: Clustering has been disabled
02.04.2012 16:42:18 org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: addressing-1.6.1 -
file:/E:/Users/C770817/SW-UMGEBUNG/axis2-1.6.1/repository-client/modules
/addressing-1.6.1.mar
>> CLIENT: SEI Async to
http://localhost:8080/jaxws-samples/services/EchoService.EchoServicePort
>> CLIENT: Connection Exception
>> CLIENT: SEI Async invocation complete.
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 11.670s
Finished at: Mon Apr 02 16:42:25 CEST 2012
Final Memory: 6M/495M
------------------------------------------------------------------------
'cmd' is not recognized as an internal or external command,
operable program or batch file.
Now we have a very smart run but I can't say yet why the
jaxws-samples/SampleClient.java reports a >> CLIENT: Connection
Exception
looking closer with debugger, which may or may not be correct, due to
many threads, and because therew are so mayn TODO's which make me
uncertain!
looking at the EchoServicecallbackHandler,
output = response.get();
results in a exception "javax.xml.ws.WebServiceException:
org.apache.axis2.AxisFault: Port number for transport http has not yet
been detected"
The fault happens when AxisInvocationController.java executes line 276
execute(opClient, false, axisRequestMsgCtx);
} catch (AxisFault af) {
if (log.isDebugEnabled()) {
log.debug(axisRequestMsgCtx.getLogIDString() + "
AxisFault received from client: " +
af.getMessage());
}
/*
* Save the exception on the callback. The client will
learn about the error when they try to
* retrieve the async results via the Response.get().
"Errors that occur during the invocation
* are reported via an exception when the client attempts to
retrieve the results of the operation."
* -- JAXWS 4.3.3
*/
/*
* TODO: This is the appropriate thing to do here since the
thrown exception may occur before
* we switch threads to the async thread. But... what
happens if we've already switched over
* to the async thread? So far, it appears that the
exception gets set on the FutureTask
* Concurrent object, and we never hit this scope. This
means that later, when the client
* calls future.get(), no exception will be thrown despite
what the spec says. The client can,
* however, retrieve errors via it's AsyncHandler.
*/
cbf.onError(af);
}
I have seen this as axis fault org.apache.axis2.AxisFault: Port number
for transport http has not yet been detected"
There is another thing very spurios and I think developers should have a
look at
in JAXWSRIWSDLGenerator.generateWSDL(...) the tempFile name is taken
from a java.io.tmpdir as "C:\Users\C770817\AppData\Local\Temp\1\_axis2"
later on a className is added and the return of axisService.getName()
resulting in
"C:\Users\C770817\AppData\Local\Temp\1\_axis2org.apache.axis2.jaxws.samp
les.client.echo.EchoServicePortTypeClient_EchoService"
this is then used to create the localOutputDirectory at
JAXWSRIWSDLGenerator.generateWSDL(...) (line 170)
AND later on
this long string is passed as argument -d to the wsdl generator
-d
"C:\Users\C770817\AppData\Local\Temp\1\_axis2org.apache.axis2.jaxws.samp
les.client.echo.EchoServicePortTypeClient_EchoService"
Looking into this directory the wsgen has never stored a file !!!
and I can not debug into
SCHWERWIEGEND: Error occurred generating WSDL file for Web service
implementation class
{org.apache.axis2.jaxws.samples.client.echo.EchoServicePortTypeClient}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
This adventure of a non-working client, a client which does not find a
port in one case, or a client which is unable to generate a wsdl file by
wsgen, brings me to the question:
WAS THIS SAMPE CLIENT RUUNING ONCE?
IF YES what shall I do, what do I miss?
Josef