Thanks Daniel for your input in this matter. Yes my original intent was for this to be a CXF client, LOL so I do want to include / invoke CXF. To that end, I scoured the internet for guidance regarding the particular approach I’m taking to build a client application, i.e., a standalone Java Spring application running as a managed (NonStop PATHWAY) server. The HP NonStop environment is well suited to this approach as the Java program runs under the native process management subsystem (PATHWAY) which manages threading, albeit heavy-weight threading. The question is, how do I include CXF in the mix. Based on my scouring, I think I need to do the following.
The current Spring application context (XML) looks like this… <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="RDDS" class="com.telus.health.pdd.business.RddsReqProcessor"> <property name="demoSs" ref="demosoapservice"></property> </bean> <bean id="demosoapservice" class="com.telus.health.pdd.asyncdemo.AsyncDemoService"> <constructor-arg type="java.net.URL" value="http://<ip_addr>:<port_no>/nssoap01/casz/jadmin/pway-wsdl/CASZ_SoapPW_AsyncDemo.wsdl"/> </bean> </beans> It should look more like this… <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"<http://cxf.apache.org/schemas/jaxws.xsd%22>> <bean id="RDDS" class="com.telus.health.pdd.business.RddsReqProcessor"> <property name="demoSs" ref="demosoapservice"></property> </bean> <bean id="demosoapservice" class="com.telus.health.pdd.asyncdemo.AsyncDemoService"> <constructor-arg type="java.net.URL" value="http://<ip_addr>:<port_no>/nssoap01/casz/jadmin/pway-wsdl/CASZ_SoapPW_AsyncDemo.wsdl"/> </bean> <bean id="proxyFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property name="serviceClass" value=" com.telus.health.pdd.asyncdemo.AsyncDemoService "/> <property name="address" value="http://<ip_addr>:<port_no>/servlets/PddAsyncWS/services/control"/<http://%3cip_addr%3e:%3cport_no%3e/servlets/PddAsyncWS/services/control%22/>> </bean> <bean id=" demosoapservice " class="com.telus.health.pdd.asyncdemo.AsyncDemoService" factory-bean="proxyFactory" factory-method="create"/> </beans> Cheers David From: Daniel Kulp [via CXF] [mailto:[email protected]] Sent: April 11, 2014 12:57 PM To: David Wiseman Subject: Re: Getting java.lang.ClassCast Exception: javax.xml.ws.Holder cannot be cast to java.lang.String On Apr 11, 2014, at 11:53 AM, David Wiseman <[hidden email]</user/SendEmail.jtp?type=node&node=5742721&i=0>> wrote: > > 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? Well, CXF is certainly less buggy around the more complex use cases and is much more secure as well. > I could be totally wrong but I don't think my casting exception is related > to the jaxws implementation. Actually, it is. I’m not sure if the RI’s async methods handle the holder things at all. I would definitely suggest trying with CXF. Either that or try generating “Bare” style methods so the holders are not there. Dan > > 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/lib > > 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:[hidden > email]</user/SendEmail.jtp?type=node&node=5742721&i=1>] > Sent: April 11, 2014 06:40 AM > To: [hidden email]</user/SendEmail.jtp?type=node&node=5742721&i=2> > 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: [hidden >> email]</user/SendEmail.jtp?type=node&node=5742721&i=3><mailto:[hidden >> email]</user/SendEmail.jtp?type=node&node=5742721&i=4>> [mailto:[hidden >> email]</user/SendEmail.jtp?type=node&node=5742721&i=5>] > >> Sent: Donnerstag, 10. April 2014 19:59 > >> To: [hidden >> email]</user/SendEmail.jtp?type=node&node=5742721&i=6><mailto:[hidden >> email]</user/SendEmail.jtp?type=node&node=5742721&i=7>> > >> 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. -- Daniel Kulp [hidden email]</user/SendEmail.jtp?type=node&node=5742721&i=8> - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com ________________________________ If you reply to this email, your message will be added to the discussion below: http://cxf.547215.n5.nabble.com/Getting-java-lang-ClassCast-Exception-javax-xml-ws-Holder-cannot-be-cast-to-java-lang-String-tp5742667p5742721.html To unsubscribe from Getting java.lang.ClassCast Exception: javax.xml.ws.Holder cannot be cast to java.lang.String, click here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5742667&code=ZGF2aWQud2lzZW1hbkB0ZWx1cy5jb218NTc0MjY2N3w2NjEwMDUyMzY=>. NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> -- 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-lang-String-tp5742667p5742769.html Sent from the cxf-user mailing list archive at Nabble.com.
