Hi,

If you are implementing asynchronous WS- clients/services, I tried to summarize 
CXF async approaches for SOAP services in following blog: 
http://ashakirin-cxf-async.blogspot.de/
I hope that can be helpful as well :)

Regards,
Andrei.

> -----Original Message-----
> From: David Wiseman [mailto:[email protected]]
> Sent: Freitag, 11. April 2014 17:53
> To: [email protected]
> Subject: RE: Getting java.lang.ClassCast Exception: javax.xml.ws.Holder cannot
> be cast to java.lang.String
> 
> Hi Andrei,
> 
> 
> 
> Appreciate your reply.
> 
> 
> 
> Good point... you are correct, there is nothing about CXF in my classpath (see
> below).   I suspect I should replace some or all of the Spring jars with CXF 
> jars.
> Dumb question is there any advantage to running the CXF implementation over
> the Java jaxws implementation, like CXF is faster?  I could be totally wrong 
> but I
> don't think my casting exception is related to the jaxws implementation.
> 
> 
> 
> My feeling now is that I'm starting with the wrong  approach, i.e., right from
> the WSDL definition I'm building from.  As you can see in the code snippet
> below all parameters are mode.INOUT.  In my mind this doesn't make sense for
> an asynchronous web service client, i.e., they should be IN only hence the
> Holder class won't be involved at least not for input parameters.
> 
> 
> 
> NonStop Server Definition...
> 
> SERVER PDDWSCLNTSRV
> 
>   PROCESSTYPE OSS
> 
>   ARGLIST -Xabend,-Xms128m,-Xmx128m,-Xoptgc,-Xverbosegc:file=stdout,
> 
>     -Xloggc:stderr,-Dsun.reflect.inflationThreshold=1,
> 
>     "-agentlib:jdwp=transport=dt_socket,address=8011,server=y,suspend=n",
> 
>     -Dlog4j.configuration=log4j.properties,-Dlog4j.debug,
> 
>     com.telus.health.pdd.access.DbRequestHandler
> 
>   AUTORESTART 0
> 
>   CREATEDELAY 10 SECS
> 
>   CWD /usr/health/drug/zcas
> 
>   DEBUG OFF
> 
>   DELETEDELAY 10 MINS
> 
>   ENV
> _RLD_LIB_PATH=/usr/tandem/javaexth10/lib:/usr/health/drug/common/log4j/l
> ib
> 
>   ENV
> 
>     CLASSPATH=/usr/tandem/sash/spring311/dist/org.springframework.beans-
> 3.1.1.RE
> 
>     LEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.context-
> 3.1.1.
> 
> 
> RELEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.expression-
> 3
> 
> 
> .1.1.RELEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.core-3.
> 
>     1.1.RELEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.jdbc-
> 3.1
> 
> 
> .1.RELEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.transacti
> 
>     on-
> 3.1.1.RELEASE.jar:/usr/tandem/sash/spring311/dist/org.springframework.asm
> 
>     -
> 3.1.1.RELEASE.jar:/usr/tandem/javaexth10/lib/tdmext.jar:/usr/tandem/java/jr
> 
>     e/lib/ext/util.jar:/usr/health/drug/common/commons-logging-
> 1.1.1.jar:/usr/he
> 
>    alth/drug/common/commons-lang3-
> 3.1.jar:/usr/health/drug/common/log4j/lib/log
> 
>     4j-
> 1.2.17.jar:/usr/health/drug/common/log4j/lib/pddlog4j2.jar:/usr/health/dr
> 
>     ug/zcas:/usr/health/drug/zcas/bin/PDDWSClntMngr.jar
> 
>   HIGHPIN ON
> 
>   HOMETERM \DNB1.$VDRG1
> 
>   LINKDEPTH 16
> 
>   MAXLINKS 16
> 
>   MAXSERVERS 2
> 
>   NUMSTATIC 1
> 
>   OWNER \DNB1.200,4
> 
>   PRI 170
> 
>   PROGRAM /usr/tandem/nssjava/jdk160_h60/jre/bin/java
> 
>   SECURITY "N"
> 
>   STDERR /usr/health/drug/zcas/pddWSsrv.err
> 
>   STDOUT /usr/health/drug/zcas/pddWSsrv.out
> 
>   TMF ON
> 
>   VOLUME \DNB1.$OSS.CASZOBEY
> 
> 
> 
> 
> 
> Web Service Client Interface...
> 
> /**
> 
> * This class was generated by Apache CXF 2.7.2
> 
> * 2014-04-10T10:49:44.965-04:00
> 
> * Generated source version: 2.7.2
> 
> *
> 
>  */
> 
> @WebService(targetNamespace = "urn:AsyncDemo-interface", name =
> "portAsyncDemo")
> 
> @XmlSeeAlso({ObjectFactory.class})
> 
> public interface PortAsyncDemo {
> 
> 
> 
>     @RequestWrapper(localName = "AsyncDemo", targetNamespace =
> "urn:cpq_tns_AsyncDemo", className =
> "com.telus.health.pdd.asyncdemo.AsyncDemo")
> 
>     @ResponseWrapper(localName = "AsyncDemoResponse0",
> targetNamespace = "urn:cpq_tns_AsyncDemo", className =
> "com.telus.health.pdd.asyncdemo.AsyncDemoResponse0")
> 
>     @WebMethod(operationName = "AsyncDemo")
> 
>     public Response<com.telus.health.pdd.asyncdemo.AsyncDemoResponse0>
> asyncDemoAsync(
> 
>         @WebParam(mode = WebParam.Mode.INOUT, name = "client_no",
> targetNamespace = "urn:cpq_tns_AsyncDemo")
> 
>         javax.xml.ws.Holder<java.lang.String> clientNo,
> 
>         @WebParam(mode = WebParam.Mode.INOUT, name = "group_no",
> targetNamespace = "urn:cpq_tns_AsyncDemo")
> 
>         javax.xml.ws.Holder<java.lang.String> groupNo,
> 
>         @WebParam(mode = WebParam.Mode.INOUT, name = "cert_no",
> targetNamespace = "urn:cpq_tns_AsyncDemo")
> 
>         javax.xml.ws.Holder<java.lang.String> certNo
> 
>     );
> 
> David
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Andrei Shakirin [mailto:[email protected]]
> Sent: April 11, 2014 06:40 AM
> To: [email protected]
> Subject: RE: Getting java.lang.ClassCast Exception: javax.xml.ws.Holder cannot
> be cast to java.lang.String
> 
> 
> 
> Hi David,
> 
> 
> 
> I do not see CXF in your stack trace. Are you sure that you have CXF jars in
> classpath?
> 
> Actually it looks that you use default JDK jaxws implementation.
> 
> 
> 
> Regards,
> 
> Andrei.
> 
> 
> 
> 
> 
> > -----Original Message-----
> 
> > From: [email protected]<mailto:[email protected]>
> [mailto:[email protected]]
> 
> > Sent: Donnerstag, 10. April 2014 19:59
> 
> > To: [email protected]<mailto:[email protected]>
> 
> > Subject: Getting java.lang.ClassCast Exception: javax.xml.ws.Holder
> 
> > cannot be cast to java.lang.String
> 
> >
> 
> > Hi CXF Community,
> 
> >
> 
> > I've been working with CXF for a several months now on a NonStop server.
> 
> > I've built sychronous demo clients and servlets with no problems.  I'm
> 
> > now trying to build an asynchronous client but I can't seem to get
> 
> > past the following ClassCastException which occurs as soon as I call...
> 
> >
> 
> > AsyncDemoResponse0 reply = asyncDemoResp.get();
> 
> >
> 
> > i.e., same point as  GreetMeSometimeResponse reply =
> 
> > greetMeSomeTimeResp.get(); from example page.
> 
> >
> 
> > Just like in the Async Consumer example page, wsl2java generates 3
> 
> > method in the web service interface class, i.e., synchronous, polling and
> callback.
> 
> > When I invoke the synchronous form everything works fine.
> 
> >
> 
> > My thought is this is a newbie error but if this description is not
> 
> > obvious, I can provide more information on advisement.
> 
> >
> 
> > Also note when I call my /Response<GreetMeSometimeResponse>
> 
> > greetMeSomeTimeResp =
> 
> >       port.greetMeSometimeAsync(System.getProperty("user.name"));
> 
> > /*equivalent*, namely, (/Response<AsyncDemoResponse0> asyncDemoResp
> =
> 
> > asyncDemoPort.asyncDemoAsync(_asyncDemo_clientNo,
> 
> > _asyncDemo_groupNo, _asyncDemo_certNo/); no activity is detected on
> 
> > the servlet (service) side, i.e., nothing appears in the web server's 
> > access.log.
> 
> >
> 
> > Any thought would be appreciated.
> 
> >
> 
> > =2014-04-10 13:50:18,485 ERROR [main] trace.event           - Web Service
> 
> > invocation error (javax.xml.ws.WebServiceException:
> 
> > java.lang.ClassCastException: javax.xml.ws.Holder cannot be cast to
> 
> > java.lang.String).
> 
> > java.util.concurrent.ExecutionException: javax.xml.ws.WebServiceException:
> 
> > java.lang.ClassCastException: javax.xml.ws.Holder cannot be cast to
> 
> > java.lang.String
> 
> >         at
> 
> > java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
> 
> >         at java.util.concurrent.FutureTask.get(FutureTask.java:83)
> 
> >         at
> 
> > com.telus.health.pdd.business.RddsReqProcessor.processRequest(RddsReqP
> 
> > roc
> 
> > essor.java:691)
> 
> >         at
> 
> > com.telus.health.pdd.access.DbRequestHandler.processRequest(DbRequestH
> 
> > an
> 
> > dler.java:391)
> 
> >         at
> 
> > com.telus.health.pdd.access.DbRequestHandler.main(DbRequestHandler.jav
> 
> > a:1
> 
> > 39)
> 
> > Caused by: javax.xml.ws.WebServiceException: java.lang.ClassCastException:
> 
> > javax.xml.ws.Holder cannot be cast to java.lang.String
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.AsyncInvoker.run(AsyncInvoker.java:59)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.AsyncResponseImpl.run(AsyncResponseImpl
> 
> > .java
> 
> > :73)
> 
> >         at
> 
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
> 
> > tor.j
> 
> > ava:886)
> 
> >         at
> 
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
> 
> > 908)
> 
> >         at java.lang.Thread.run(Thread.java:619)
> 
> > Caused by: java.lang.ClassCastException: javax.xml.ws.Holder cannot be
> 
> > cast to java.lang.String
> 
> >         at
> 
> > com.telus.health.pdd.asyncdemo.AsyncDemo$JaxbAccessorF_certNo.set(Fiel
> 
> > dA
> 
> > ccessor_Ref.java:45)
> 
> >         at
> 
> > com.sun.xml.internal.bind.v2.runtime.reflect.Accessor.setUnadapted(Acc
> 
> > essor.j
> 
> > ava:155)
> 
> >         at
> 
> >
> com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$7.set(JAXBContextImpl.
> 
> > java:926)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.sei.BodyBuilder$DocLit.build(BodyBuilde
> 
> > r.java:2
> 
> > 07)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.sei.BodyBuilder$JAXB.createMessage(Body
> 
> > Build
> 
> > er.java:88)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.sei.SEIMethodHandler.createRequestMessa
> 
> > ge(S
> 
> > EIMethodHandler.java:204)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.sei.AsyncMethodHandler$SEIAsyncInvoker.
> 
> > do_ru
> 
> > n(AsyncMethodHandler.java:147)
> 
> >         at
> 
> > com.sun.xml.internal.ws.client.AsyncInvoker.run(AsyncInvoker.java:54)
> 
> >         ... 4 more
> 
> >
> 
> > Final note: the the only alteration I made to support asynchronous web
> 
> > service on the service (servlet) side was the inclusion of
> 
> > <async-supported>true</async-
> 
> > supported> in the deplyment descriptor (web.xml).
> 
> >
> 
> > David
> 
> >
> 
> >
> 
> >
> 
> > --
> 
> > View this message in context:
> 
> > http://cxf.547215.n5.nabble.com/Getting-java-
> 
> > lang-ClassCast-Exception-javax-xml-ws-Holder-cannot-be-cast-to-java-la
> 
> > ng-
> 
> > String-tp5742667.html
> 
> > Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to