I am trying to run Client class in the java_first_spring_support sample project
which comes with the cxf distribution. My environment is Eclipse Ganymede in
Windows Vista, JDK 1.6.0_07, apache-CXF-2.1.1, Jboss 4.2.2 and web-app version 2.4. I put the files from cxf/lib into a WEB-INF/lib directory. There is no classpath entry in MANIFEST.MF
I am able to see the wsdl through the browser with
http://localhost:8080/samples/HelloWorld?wsdlHowever, when I try running the client, I get the error listed below. I seem to be missing something in setting up my environment as I have the same problem with another service I created.
========================
The client code is as in the sample, and the error occurs on the first line where the Application context is being created:
public static void main(String args[]) throws Exception {
// START SNIPPET: client
ClassPathXmlApplicationContext context
= new ClassPathXmlApplicationContext(new String[] {"demo/spring/client/client-beans.xml"});
HelloWorld client = (HelloWorld)context.getBean("client");
String response = client.sayHi("Joe");
System.out.println("Response: " + response);
System.exit(0);
// END SNIPPET: client
}
=====================
The client-beans.xml is:
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="
http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
<bean id="client" class="demo.spring.HelloWorld"
factory-bean="clientFactory" factory-method="create"/>
<bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="demo.spring.HelloWorld"/>
<property name="address" value="
http://localhost:8080/HelloWorld"/>
</bean>
</beans>
====================
And the beans.xml is:
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="
http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint
id="helloWorld"
implementor="demo.spring.HelloWorldImpl"
address="/HelloWorld" />
</beans>
====================
Jul 24, 2008 11:07:42 AM org.apache.cxf.bus.spring.BusApplicationContext getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Jul 24, 2008 11:07:42 AM org.apache.cxf.bus.spring.SpringBusFactory createBus
WARNING: Failed to create application context.
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/cxf/cxf.xml]; nested exception is java.lang.IllegalAccessError: tried to access method com.ctc.wstx.stax.WstxInputFactory.createPrivateConfig()Lcom/ctc/wstx/api/ReaderConfig; from class com.ctc.wstx.sax.WstxSAXParser
Caused by: java.lang.IllegalAccessError: tried to access method com.ctc.wstx.stax.WstxInputFactory.createPrivateConfig()Lcom/ctc/wstx/api/ReaderConfig; from class com.ctc.wstx.sax.WstxSAXParser
at com.ctc.wstx.sax.WstxSAXParser.<init>(WstxSAXParser.java:128)
at com.ctc.wstx.sax.WstxSAXParserFactory.newSAXParser(WstxSAXParserFactory.java:105)
at org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(TunedDocumentLoader.java:106)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:361)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:108)
...
...
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:76)
at demo.spring.client.Client.main(Client.java:35)
==================
I would appreciate any help. Thanks.
Thanks
cortlander