On Friday 03 December 2010 1:47:08 pm Zarar Siddiqi wrote:
> Hi,
>
> Got two apps serving as a client to an external web service, one is on
> Tomcat and one is on Glassfish. The Tomcat one works like a charm, but
> Glassfish keeps throwing the classic ClassCastException:
>
> com.sun.xml.ws.client.sei.SEIStub cannot be cast to
> org.apache.cxf.frontend.ClientProxy
>
> Funny part is that I have cxf-bundle already in the classpath of the war
> inside the ear and it contains the javax.xml.ws.spi.Provider file which
> contains the line org.apache.cxf.jaxws.spi.ProviderImpl. So I dont' see
> why it's using the provider that comes bundled with the JDK in rt.jar. I
> even tried putting the cxf-bundle jar at the root of the EAR but that
> doesn't do it either. I even tried setting it using System.setProperty()
> and also attempted to create a file manually under WEB-INF/classes/... but
> nothing.
>
> Any ideas on what might be missing?
I'm definitely surprised the system property didn't work. I wonder if a
combination of setting the system property and then making sure the the
contextClassLoader().getResource("META-INF/...") call grabs the file would
work.
You could just do use the JaxWsProxyFactoryBean in CXF directly to create the
client proxy. That would bypass the SPI stuff.
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:9000/helloWorld");
HelloWorld client = factory.create(HelloWorld.class);
--
Daniel Kulp
[email protected]
http://dankulp.com/blog