> -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Friday, October 15, 2010 8:55 AM > To: [email protected] > Subject: Re: Annotation to self-register service bean? > > Hi David > > So this time you have an external model referring to some interface but > this > time > you expect that having a "component-scan" element would help with > finding > concrete > implementations of the interface ?
No, I'm not using interfaces. I have a concrete service bean. > I'm not sure how it can work. The provisioning of concrete > implementations > should be driven by a user (example, by specifying a > jaxrs:server/serviceBeans section or registering an OSGI service - > interface(s) plus object, etc). > Otherwise we may have a case whereon 2 1 concrete implementation > qualifies > and the other one is not supposed to be used as a jaxrs resource, etc, > if > say we have multiple implementations in the same package being scanned > now. > > That said I'd be interested to see a concrete test webapp which > demonstrates > the issue and may be CXF JAXRS can get updated a bit so that external > model > referring to interfaces is applied to concrete implementations > discovered by > the scanning facility. This can be cool after all... If you can create > a > sample webapp or maven project and attach it to the JIRA then I'd try > to > look into it. > > Currently one only can drop jaxrs:server/serviceBeans if the external > model > refers to concrete classes. > > I'm away next week so will only be able to reply on the week starting > 25th > October > > cheers, Sergey > > I'm still unsure what I can do here. I tried commenting out my > > "serviceBeans" section and the explicit bean definition. My > Controller > > has a "@Controller" annotation, and my "component-scan" element > > specifies the parent package of the Controller's package. > > > > When I start up now, I see the following: > > > > ----------------------------- > > Oct 14, 2010 10:51:13 AM > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean > > checkResources > > SEVERE: No resource classes found > > [main] WARN > > org.springframework.beans.factory.support.DisposableBeanAdapter - > > Invocation of destroy method 'shutdown' failed on bean with name > 'cxf': > > org.springframework.beans.factory.BeanCreationNotAllowedException: > Error > > creating bean with name > > 'org.apache.cxf.buslifecycle.BusLifeCycleManager': Singleton bean > > creation not allowed while the singletons of this factory are in > > destruction (Do not request a bean from a BeanFactory in a destroy > > method implementation!) > > [main] ERROR org.springframework.web.context.ContextLoader - Context > > initialization failed > > org.springframework.beans.factory.BeanCreationException: Error > creating > > bean with name 'SunlightDataServer': Invocation of init method > failed; > > nested exception is > > org.apache.cxf.service.factory.ServiceConstructionException > > at > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa > c > > tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) > > at > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa > c > > tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) > > ... > > Caused by: > org.apache.cxf.service.factory.ServiceConstructionException > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBe > a > > n.java:132) > > ... > > Caused by: javax.ws.rs.WebApplicationException > > at > > > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJA > X > > RSFactoryBean.java:270) > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBe > a > > n.java:87) > > ... > > Oct 14, 2010 10:51:13 AM org.apache.catalina.core.StandardContext > > listenerStart > > SEVERE: Exception sending context initialized event to listener > instance > > of class org.springframework.web.context.ContextLoaderListener > > org.springframework.beans.factory.BeanCreationException: Error > creating > > bean with name 'SunlightDataServer': Invocation of init method > failed; > > nested exception is > > org.apache.cxf.service.factory.ServiceConstructionException > > at > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa > c > > tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) > > at > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFa > c > > tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) > > ... > > Caused by: > org.apache.cxf.service.factory.ServiceConstructionException > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBe > a > > n.java:132) > > ... > > Caused by: javax.ws.rs.WebApplicationException > > at > > > org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJA > X > > RSFactoryBean.java:270) > > at > > > org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBe > a > > n.java:87) > > ... > > Oct 14, 2010 10:51:13 AM org.apache.catalina.core.StandardContext > start > > SEVERE: Error listenerStart > > Oct 14, 2010 10:51:13 AM org.apache.catalina.core.StandardContext > start > > SEVERE: Context [/SunlightDataService] startup failed due to previous > > errors > > ------------------------ > > > > None of this happens if I have the "serviceBeans" section. > >
