On Tuesday, November 08, 2011 1:24 PM, "Sergey Beryozkin" <sberyoz...@gmail.com> wrote: > Hi > On 08/11/11 13:16, Jon Barber wrote: > > On Tuesday, November 08, 2011 10:02 AM, "Jon Barber" > > <jon.bar...@acm.org> wrote: > >> Apologies for the delayed reply. Comments in line below. > >> > >> On Monday, October 31, 2011 10:28 PM, "Sergey Beryozkin" > >> <sberyoz...@gmail.com> wrote: > >>> Hi > >>> > >>> On 27/10/11 16:28, Jon Barber wrote: > >>>> Hi List, > >>>> > >>>> I've managed to get CXF DOSGi 1.2 working with JSON responses following > >>>> the discussions I found on this list. However, I've hit a problem when I > >>>> try to use the OSGi HTTP Service via the > >>>> org.apache.cxf.ws.httpservice.context property. > >>>> > >>>> So I've adapted the greeter rest sample from the distribution and added > >>>> the following properties to the services : > >>>> > >>>> > >>>> props.put("service.exported.interfaces", "*"); > >>>> props.put("service.exported.configs", "org.apache.cxf.rs"); > >>>> props.put("service.exported.intents", "HTTP"); > >>>> > >>>> props.put("org.apache.cxf.rs.provider","org.apache.cxf.jaxrs.provider.AegisElementProvider,org.apache.cxf.jaxrs.provider.AegisJSONProvider"); > >>>> > >>>> Then for the first case I register an address for the service to use, > >>>> e.g. > >>>> > >>>> > >>>> props.put("org.apache.cxf.rs.address","http://localhost:8282/greeter2"); > >>>> > >>>> This works like a charm : curl > >>>> http://localhost:8282/greeter2/greeter/greeting/fred > >>>> {"ns1.GreeterInfo":{"@xsi.type":"ns1:GreeterInfo","ns1.greetings":{"ns1.GreetingPhrase":[{"@xsi.type":"ns1:GreetingPhrase","ns1.name":"fred","ns1.phrase":"Hello"},{"@xsi.type":"ns1:GreetingPhrase","ns1.name":"fred","ns1.phrase":"Hoi"},{"@xsi.type":"ns1:GreetingPhrase","ns1.name":"fred","ns1.phrase":"Hola"},{"@xsi.type":"ns1:GreetingPhrase","ns1.name":"fred","ns1.phrase":"Bonjour"}]}}} > >>>> > >>>> > <snip/> > > >>>> Caused by: java.lang.IllegalArgumentException: No SchemaFactory that > >>>> implements the schema language specified by: > >>>> http://www.w3.org/2001/XMLSchema could be loaded > >>>> at javax.xml.validation.SchemaFactory.newInstance(Unknown > >>>> Source) > >>>> at > >>>> > >>>> org.apache.cxf.aegis.type.XMLTypeCreator.<clinit>(XMLTypeCreator.java:118) > >>>> > >>>> This is using Java 1.6.0_27, CXF DOSGi 1.2 and Felix 3.2.2. I configured > >>>> felix as per the conf in the cxf distribution with the addition of the > >>>> jettison jar and my modified greeter bundle - config is viewable at > >>>> http://pastebin.com/m8Qa8pLw > >>> > >>> I vaguely recall seeing something like that before. > >>> Does it happen with Aegis only, when requesting JSON or XMl or both ? > >>> Can you please try JAXB ? > >> > >> OK, I'll try and find out how I use JAXB in place of Aegis. Could you > >> provide a pointer to some docs etc ? > >> > > > > OK, so I set the "org.apache.cxf.ws.databinding" property to "jaxb" and > > I still get exactly the same stack trace. > > > > That is a ws-specific property, given that JAX-RS is used, just remove > >>>> > props.put("org.apache.cxf.rs.provider","org.apache.cxf.jaxrs.provider.AegisElementProvider,org.apache.cxf.jaxrs.provider.AegisJSONProvider"); > > as in case of JAX-RS JAXB is selected by default. > > "org.apache.cxf.rs.databinding" is kind of ignored by the JAX-RS > handler, unless "aegis" is set > > thanks, Sergey
Hi Sergey, So now I see : "No message body writer has been found for response class GreeterInfo." Jon. > > > > >>> > >>>> > >>>> I can work around this, in that if I set the address to be the same as > >>>> the OSGi HTTP service is already using then that works fine, > >>> > >>> Can you clarify it please ? > >> > >> So I mean that if the HTTP service is configured to listen to port 9000 > >> then if I set the property like this : > >> > >> > >> props.put("org.apache.cxf.rs.address","http://localhost:9000/greeter2"); > >> > >> then that works fine. > >> > >> However, I'd rather not do that (set an absolute address) as we have > >> different configurations for our different environments. > >> > >>> > >>> Cheers, Sergey > >>> > >>>> but I'd > >>>> rather not do that as we would need to remember to change the property > >>>> if we ever change the port to be consistent. > >>>> > >>>> Any help would be gratefully received. > >>>> > >>>> Thanks, > >>>> > >>>> Jon. > >>> > >>> > >> > >