hanks. That doesn't really explain, to me, why the server starts up
fine when deployed but fails with the error shown when run in a JUnit
test. The demo is able to create a service in JUnit without problem.
In this particular JUnit, rather than relying on Spring configuration,
I was attempting to create the server myself using the following code:
private Server createRestServer(SessionFactory sessionFactory) {
MyServiceImpl service = new MyServiceImpl();
service.setSessionFactory(sessionFactory);
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(MyServiceInterface.class);
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sf.setAddress("http://localhost:8080/rest/");
sf.getServiceFactory().setInvoker(new BeanInvoker(service));
sf.getServiceFactory().setWrapped(true);
return sf.create();
}
This is almost exactly the same as the server code from the demo - the
code that works. However, in my example I receive the stack trace from
above on the sf.create() method.
On 11/4/07, Liu, Jervis <[EMAIL PROTECTED]> wrote:
> I probabaly should remove JAX-WS style client codes from restful_http_binding
> demo, as it constantly causes confusions. In theory, JAX-WS style client APIs
> should work with RESTful services that published using CXF HTTP binding, as
> this is symmetric to what the server side has to do to marshal/unmarshal
> request/response. But in reality, this does not work because a). This JAX-WS
> style client APIs support is not completed yet. b). I don't think there will
> be much value added by supporting JAX-WS style client APIs. This JAX-WS style
> client APIs wont work without a WSDL, most RESTful services wont have a WSDL.
> More comments about client side REST API support can be found in [1].
>
> [1].
> http://www.nabble.com/Using-verbs-other-than-GET-from-a-RESTful-client-application-tf4628659.html
>
> Cheers,
> Jervis
>
> > -----Original Message-----
> > From: Todd Orr [mailto:[EMAIL PROTECTED]
> > Sent: 2007?11?5? 10:41
> > To: [email protected]
> > Subject: ClientFactoryBean AbstractMethodError
> >
> >
> > I have been trying to get a REST service up and running. I believe the
> > server is up. However, creating the client is problematic. Using the
> > following code borrowed from the bundled rest sample:
> >
> > JaxWsProxyFactoryBean sf = new JaxWsProxyFactoryBean();
> > sf.setServiceClass(MyServiceInterface.class);
> >
> > // Turn off wrapped mode to make our xml prettier
> > sf.getServiceFactory().setWrapped(false);
> >
> > // Use the HTTP Binding which understands the Java Rest Annotations
> > sf.getClientFactoryBean().setBindingId(HttpBindingFactory.HTTP
> _BINDING_ID);
> > sf.setAddress("http://localhost:8080/rest/");
> > this.service = (MyServiceInterface) sf.create();
> >
> >
> > I receive the following exception:
> >
> > java.lang.AbstractMethodError:
> > org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lan
> g/String;
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
> orImpl.java:39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:597)
> > at
> > org.apache.ws.commons.schema.utils.DOMUtil.getInputEncoding(DO
> > MUtil.java:594)
> > at
> > org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchem
> > aCollection.java:348)
> > at
> > org.apache.cxf.databinding.source.AbstractDataBinding.addSchem
> > aDocument(AbstractDataBinding.java:73)
> > at
> > org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding
> .java:224)
> > at
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.bu
> > ildServiceFromClass(ReflectionServiceFactoryBean.java:293)
> > at
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.in
> > itializeServiceModel(ReflectionServiceFactoryBean.java:333)
> > at
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.cr
> > eate(ReflectionServiceFactoryBean.java:151)
> > at
> > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(Ja
> xWsServiceFactoryBean.java:93)
> > at
> > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.creat
> > eEndpoint(AbstractWSDLBasedEndpointFactory.java:74)
> > at
> > org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactory
> Bean.java:51)
> > at
> > org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientPr
> oxyFactoryBean.java:89)
> > at com.foo.bar.RestTest.injectDependencies(RestTest.java:30)
> > at
> > org.springframework.test.AbstractDependencyInjectionSpringCont
> > extTests.prepareTestInstance(AbstractDependencyInjectionSpring
> ContextTests.java:158)
> > at
> > org.springframework.test.AbstractSingleSpringContextTests.setU
> > p(AbstractSingleSpringContextTests.java:88)
> > at junit.framework.TestCase.runBare(TestCase.java:125)
> > at
> > org.springframework.test.ConditionalTestCase.runBare(Condition
> alTestCase.java:69)
> > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > at junit.framework.TestResult.run(TestResult.java:109)
> > at junit.framework.TestCase.run(TestCase.java:118)
> > at junit.framework.TestSuite.runTest(TestSuite.java:208)
> > at junit.framework.TestSuite.run(TestSuite.java:203)
> > at
> > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReferen
> > ce.run(JUnit3TestReference.java:130)
> > at
> > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestEx
> ecution.java:38)
> > at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
> > s(RemoteTestRunner.java:460)
> > at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTest
> > s(RemoteTestRunner.java:673)
> > at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Rem
> oteTestRunner.java:386)
> > at
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(Re
> moteTestRunner.java:196)
> >
> >
> > I read a post regarding a similar error due to the XmlSchema version.
> > However, after checking, I do have the 1.3.2 version specified in that
> > post
> > (http://www.nabble.com/wsdl2java-problem-tf4651922.html#a13290874).
> >
> > Anyone have any other ideas?
> >
> > Thanks.
> >
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
>