- 
        1. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 3:50 AM (in response to moweis)Can you copy/paste your client code here? 
- 
        2. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 3:55 AM (in response to moweis)Sure: 
 Here is my client code:package org.jboss.test.ws.jaxws.samples.wsrm.client; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import org.jboss.ws.core.StubExt; import org.jboss.ws.extensions.wsrm.api.RMProvider; import org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService; public final class SimpleServiceTestCase { private static final String serviceURL = "http://localhost:8080/jaxws-samples-wsrm/SimpleService"; public static void main(String[] args) throws Exception { String url = null; if ( args != null && args.length > 0 && args[0] != null ) url = args[0]; else url = serviceURL; System.out.println("Calling wsdl"); QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService"); QName portName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleServicePort"); URL wsdlURL = new URL(url + "?wsdl"); Service service = Service.create(wsdlURL, serviceName); SimpleService proxy = (SimpleService)service.getPort(SimpleService.class); ((StubExt)proxy).setConfigName("Standard Anonymous WSRM Client", "META-INF/wsrm-jaxws-client-config.xml"); proxy.ping(); // one way call proxy.echo("Hello World!"); // request responce call ((RMProvider)proxy).closeSequence(); } }
 It is directly from the client example on the page:
 http://jbws.dyndns.org/mediawiki/index.php?title=Native_WS-ReliableMessaging_Tutorial#Updating_Client_Code_to_Reference_Custom_JAX-WS_Config_File_and_Close_the_Sequence
- 
        3. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 4:59 AM (in response to moweis)"moweis" wrote: 
 I get the following exception:Exception in thread "main" java.lang.ClassCastException: $Proxy25 cannot be cast to org.jboss.ws.core.StubExt 
 in advance!
 And what is the full stack trace?
- 
        4. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 5:03 AM (in response to moweis)Here is the full stack trace: Exception in thread "main" java.lang.ClassCastException: $Proxy25 cannot be cast to org.jboss.ws.core.StubExt 
 at org.jboss.test.ws.jaxws.samples.wsrm.client.SimpleServiceTestCase.main(SimpleServiceTestCase.java:30)
 Line 30 is:((StubExt)proxy).setConfigName("Standard Anonymous WSRM Client", "META-INF/wsrm-jaxws-client-config.xml");
- 
        5. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 5:32 AM (in response to moweis)Are you using jbossws only libs? 
 What is your client classpath?
- 
        6. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 5:36 AM (in response to moweis)I'm wondering if the wsconsume didn't run properly? 
 I ran it twice:
 First with a non-WS-Policy wsdl
 Second with WS-Policy wsdl
 Both generated the same files.
 Is that correct?
- 
        7. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 5:39 AM (in response to moweis)Yes, here is my command-line execution: 
 /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -classpath .:../wsconsume/generated/classes/:${JBOSS_WS_HOME}/deploy/lib/jbossws-native-core.jar org.jboss.test.ws.jaxws.samples.wsrm.client.SimpleServiceTestCase
- 
        8. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 5:42 AM (in response to moweis)You have to endorse JAXWS. 
 Try to add:
 -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed
 to your client launch command.
- 
        9. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 5:50 AM (in response to moweis)I still get the same error :( /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java -classpath .:..:../wsconsume/generated/classes/:${JBOSS_WS_HOME}/deploy/lib/jbossws-native-core.jar org.jboss.test.ws.jaxws.samples.wsrm.client.SimpleServiceTestCase -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed 
 Exception in thread "main" java.lang.ClassCastException: $Proxy25 cannot be cast to org.jboss.ws.core.StubExt
 at org.jboss.test.ws.jaxws.samples.wsrm.client.SimpleServiceTestCase.main(SimpleServiceTestCase.java:30)
 marw
- 
        10. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 6:06 AM (in response to moweis)OK, did you see: 
 http://jbws.dyndns.org/mediawiki/index.php?title=Installation
 topic:
 Using JBossWS Native with JDK 6
- 
        11. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 6:28 AM (in response to moweis)Yes I did...I copied the libs as stated. 
 Question, if I run wsconsume on the wsdl with no WS-RM related info, and run it again with WS-RM configuration, should I see any difference in the generated source?
 Because looking at the generated service interface, it doesn't extend StubExt:package org.jboss.test.ws.jaxws.samples.wsrm.generated; import javax.jws.Oneway; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /** * This class was generated by the JAX-WS RI. * JAX-WS RI 2.1.3-b02- * Generated source version: 2.0 * */ @WebService(name = "SimpleService", targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wsrm") public interface SimpleService { /** * * @param arg0 * @return * returns java.lang.String */ @WebMethod @WebResult(targetNamespace = "") @RequestWrapper(localName = "echo", targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wsrm", className = "org.jboss.test.ws.jaxws.samples.wsrm.generated.Echo") @ResponseWrapper(localName = "echoResponse", targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wsrm", className = "org.jboss.test.ws.jaxws.samples.wsrm.generated.EchoResponse") public String echo( @WebParam(name = "arg0", targetNamespace = "") String arg0); /** * */ @WebMethod @Oneway @RequestWrapper(localName = "ping", targetNamespace = "http://www.jboss.org/jbossws/ws-extensions/wsrm", className = "org.jboss.test.ws.jaxws.samples.wsrm.generated.Ping") public void ping(); }
 Thanks for your help Richard
- 
        12. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 6:45 AM (in response to moweis)"moweis" wrote: 
 Question, if I run wsconsume on the wsdl with no WS-RM related info, and run it again with WS-RM configuration, should I see any difference in the generated source?
 Because looking at the generated service interface, it doesn't extend StubExt:
 No, the interface implementation is generated via Java proxies at runtime (behind the scenes)"moweis" wrote: 
 Thanks for your help Richard
 Does the client work already?
- 
        13. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Stumoweis Aug 4, 2008 6:46 AM (in response to moweis)No i still have the same error... 
- 
        14. Re: WS-RM Exception: cannot be cast to org.jboss.ws.core.Sturopalka Aug 4, 2008 7:44 AM (in response to moweis)To recapitulate your problem is wrong client classpath. 
 You didn't endorse jbossws client libraries properly.
 The last stupid question: is your JBOSS_HOME environment variable defined?
 
    