Bus has no BindingFactoryManager extension in AbstractBindingFactory.registerWithBindingManager
I'm using apache-cxf-2.0.3-incubator-20071102.144221-7 (although I see the same problem with 2.0.2) and Spring 2.5-rc1 I have a simple servlet configuration exactly as described here: http://cwiki.apache.org/CXF20DOC/servlet-transport.html and the cxf component of my spring config looks like this: RpcReviewServiceImpl.java Is: @Component @WebService (endpointInterface="com.atlassian.crucible.spi.rpc.RpcReviewService") @SOAPBinding(style=Style.RPC, use= Use.LITERAL) public class RpcReviewServiceImpl implements RpcReviewService { private ReviewService reviewService; public ReviewData createReview(ReviewData review) { return reviewService.createReview(review); } public List getAllReviews() { return reviewService.getAllReviews(); } public void setReviewService(ReviewService reviewService) { this.reviewService = reviewService; } } When I start my app (running in Jetty) I have an NPE here: [java] java.lang.NullPointerException [java] at org .apache .cxf .binding .AbstractBindingFactory .registerWithBindingManager(AbstractBindingFactory.java:60) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) [java] at sun .reflect .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) [java] at java.lang.reflect.Method.invoke(Method.java:585) [java] at org .springframework .beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor $LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java: 209) [java] at org .springframework .beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor $ LifecycleMetadata .invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:180) [java] at org .springframework .beans .factory .annotation .InitDestroyAnnotationBeanPostProcessor .postProcessBeforeInitialization (InitDestroyAnnotationBeanPostProcessor.java:98) [java] at org .springframework .beans .factory .support .AbstractAutowireCapableBeanFactory .applyBeanPostProcessorsBeforeInitialization (AbstractAutowireCapableBeanFactory.java:322) [java] at org .springframework .beans .factory .support .AbstractAutowireCapableBeanFactory .initializeBean(AbstractAutowireCapableBeanFactory.java:1299) [java] at org .springframework .beans .factory .support .AbstractAutowireCapableBeanFactory .createBean(AbstractAutowireCapableBeanFactory.java:532) [java] at org.springframework.beans.factory.support.AbstractBeanFactory $1.getObject(AbstractBeanFactory.java:238) [java] at org .springframework .beans .factory .support .DefaultSingletonBeanRegistry .getSingleton(DefaultSingletonBeanRegistry.java:167) [java] at org .springframework .beans .factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 235) [java] at org .springframework .beans .factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java: 167) [java] at org .springframework .context .support .AbstractApplicationContext.getBean(AbstractApplicationContext.java:867) [java] at org .apache.cxf.configuration.spring.SpringBeanMap.get(SpringBeanMap.java: 193) [java] at org.apache.cxf.configuration.spring.SpringBeanMap $Entry.getValue(SpringBeanMap.java:258) [java] at org .springframework .beans .TypeConverterDelegate.convertToTypedMap(TypeConverterDelegate.java:469) ... meaning that in: public abstract class AbstractBindingFactory... ... @PostConstruct void registerWithBindingManager() { BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class); for (String ns : activationNamespaces) { manager.registerBindingFactory(ns, this); } } bus.getExtension(BindingFactoryManager.class) is returning null. Any advice would be welcome. Thanks, Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
Re: Bus has no BindingFactoryManager extension in AbstractBindingFactory.registerWithBindingManager
On 07/11/2007, at 1:18 AM, Willem Jiang wrote: Hi Tom, Can you try your application with the Spring 2.0.6? We did not develop and test CXF with Spring 2.5-rc1. Thanks Willem. In fact I was using 2.1-m4, not 2.5-rc1, my mistake. I have other dependencies on Spring 2.5, so I would like to try to use it. When I use 2.5-rc1 I encounter CXF-1060. (or at least, a problem with the same symptoms). Should I expect CXF-1060 to be fixed in apache- cxf-2.0.3-incubator-20071102.144221-7? It is marked as fixed in 2.0.3 (https://issues.apache.org/jira/browse/CXF-1060 ) but the commit is on trunk (http://svn.apache.org/viewvc?view=rev&revision=581341 ) not the 2.0.x-fixes branch. Thanks, Tom
Programmatically publishing a REST endpoint
Hi, I have a SOAP services working fine, using the servlet transport. The servlet is configured in web.xml, and the end point publishing happens in the init method of the servlet (which is a subclass of CXFServlet: public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); Bus bus = this.getBus(); BusFactory.setDefaultBus(bus); Endpoint.publish("/review", SpringContext.getComponent("rpcReviewService")); Endpoint e = Endpoint.create(HTTPBinding.HTTP_BINDING, SpringContext.getComponent("restReviewService")); e.publish("/rest"); Endpoint.publish("/auth", SpringContext.getComponent("rpcAuthService")); } My RestReviewService class (based on the CustomerService example) looks like: @Component("restReviewService") @WebService @UriTemplate("/review/") public class RestReviewService { @Autowired private ReviewService reviewService; @HttpContext UriInfo uriInfo; @HttpMethod("GET") @UriTemplate("/all/") public List getAllReviews() { return reviewService.getAllReviews(); } } When I start my server the log says: ... [java] Nov 8, 2007 11:34:53 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass [java] INFO: Creating Service {http://rpc.spi.crucible.atlassian.com/ }RestReviewServiceService from class com.atlassian.crucible.spi.rpc.RestReviewService [java] Nov 8, 2007 11:34:53 AM org.apache.cxf.endpoint.ServerImpl initDestination [java] INFO: Setting the server's publish address to be /rest [java] Nov 8, 2007 11:34:53 AM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass ... But the service endpoint seems to be another SOAP service, as when I go to http://localhost:6060/foo/services/rest/review/all I get: http://schemas.xmlsoap.org/soap/ envelope/">soap:Serverfaultcode>No such operation: reviewsoap:Fault> Thanks for any tips or pointers to documentation other than http://cwiki.apache.org/CXF20DOC/rest-with-jax-ws-provider-and-dispatch.html I suspect I need to set the JAXRS binding for the endpoint, but I don't know how to do it... Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
Re: Programmatically publishing a REST endpoint
On 08/11/2007, at 7:37 PM, Liu, Jervis wrote: Here you go, a brief document on how to build RESTful services in CXF using JAX-RS (JSR-311): http://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+%28JSR-311%29 Hi Jervis, Thanks for the information. One clarification: as I'm using the servlet transport, I don't want to set an explicit address, just a path component, so that the REST API is under the URL my CXFServlet maps to. So given that I have this code to publish my SOAP services: public void init(ServletConfig servletConfig) throws ServletException { super.init(servletConfig); Bus bus = this.getBus(); BusFactory.setDefaultBus(bus); Endpoint.publish("/review", SpringContext.getComponent("rpcReviewService")); Endpoint.publish("/auth", SpringContext.getComponent("rpcAuthService")); ... REST publishing goes here ... } Can I use something like: JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setResourceClasses(RestReviewService.class); //default lifecycle is per-request, change it to singleton sf.setResourceProvider(RestReviewService.class, new SingletonResourceProvider()); sf.setBus(bus); sf.setAddress("/rest"); // will this work? sf.create(); A more general question: What are the pros and cons of using CXF HTTP binding vs. JSR-311 for REST? Thanks again, Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
Returning List via SOAP
I'm using CXF 2.0.3. I have an interface with a method like: List getAllReviews(@WebParam(name="token") String token); The WSDL created for this method is: type="tns:getAllReviewsResponse"/> type="xs:anyType"/> and so the generated SOAP client returns List Is there any way to get a return type of List (the ReviewData class generated by wsdl2java that is, not the original ReviewData in the remote interface) Thanks, Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
Re: Returning List via SOAP
On 15/02/2008, at 7:19 AM, Daniel Kulp wrote: Any chance you can try with 2.0.4? It sounds like for some reason, the ReviewData is not getting passed into the JAXB context. Not sure why that is.. Actually, what compiler flags are you using? With -o, I'm not sure if the generics is compiled in. I would assume so, but maybe not. I was able to work around this by returning arrays instead of generic Lists (wsdl2java still uses generic lists in the client interfaces it produces) I also encountered the problem that if one of my DTOs didn't have a default constructor it was silently ignored, and List used instead. Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate
JAX-RS in 2.0.4-incubator?
Is JAX-RS support in 2.0.4, or only in 2.1? If it is in 2.0.4, which jars do I need (I can't find cxf-rt-frontend-jaxrs) Thanks, Tom -- ATLASSIAN - http://www.atlassian.com Our products help over 8,500 customers in more than 95 countries to collaborate