You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Raja Kolli (JIRA)" <ji...@apache.org> on 2017/02/22 04:04:44 UTC

[jira] [Issue Comment Deleted] (CXF-7237) Upgrade to SpringBoot 1.5.x

     [ https://issues.apache.org/jira/browse/CXF-7237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Raja Kolli updated CXF-7237:
----------------------------
    Comment: was deleted

(was: I am using 3.2.0-SNAPSHOT with SpringBoot 1.5.x and it is successful when I declare jaxrs as bean with below code

@Bean
    public Server rsServer() {
        JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
        endpoint.setBus(bus);
        endpoint.setServiceBeans(Arrays.<Object>asList(new HelloServiceImpl1(), new HelloServiceImpl2()));
        endpoint.setAddress("/");
        endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
        return endpoint.create();
    }

But when I disable this bean and attempt to use auto configuration by declaring below properties in application.properties
cxf.jaxrs.component-scan=true
cxf.jaxrs.classes-scan-packages=org.apache.cxf.jaxrs.swagger

It is failing to start with below error log


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxRsServer' defined in class path resource [org/apache/cxf/jaxrs/spring/SpringComponentScanServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.endpoint.Server]: Factory method 'jaxRsServer' threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
	at com.example.poc.DemoApplication.main(DemoApplication.java:28) [classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.1.RELEASE.jar:1.5.1.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.cxf.endpoint.Server]: Factory method 'jaxRsServer' threw exception; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	... 23 common frames omitted
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: null
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:220) ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
	at org.apache.cxf.jaxrs.spring.AbstractSpringConfigurationFactory.createJaxRsServer(AbstractSpringConfigurationFactory.java:56) ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
	at org.apache.cxf.jaxrs.spring.SpringComponentScanServer.jaxRsServer(SpringComponentScanServer.java:29) ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_101]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_101]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_101]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_101]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.6.RELEASE.jar:4.3.6.RELEASE]
	... 24 common frames omitted
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: No resource classes found
	at org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.checkResources(AbstractJAXRSFactoryBean.java:317) ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:159) ~[cxf-rt-frontend-jaxrs-3.2.0-SNAPSHOT.jar:3.2.0.SNAPSHOT]
	... 31 common frames omitted


Can you look into this? FYI this code is working perfectly with 3.1.9
Here is the sample code which can be used to reproduce the errot https://github.com/rajadilipkolli/POC/tree/master/spring-boot-sample-ws-cxf-restful
)

> Upgrade to SpringBoot 1.5.x
> ---------------------------
>
>                 Key: CXF-7237
>                 URL: https://issues.apache.org/jira/browse/CXF-7237
>             Project: CXF
>          Issue Type: Improvement
>          Components: Integration
>            Reporter: Sergey Beryozkin
>            Assignee: Sergey Beryozkin
>             Fix For: 3.2.0
>
>
> Right now CXF SpringBoot starters depend on SpringBoot 1.4.x and they have also been updated to make sure they can be run with SpringBoot 1.5.x.
> The question is if we should upgrade CXF starters to depend on 1.5.x, i.e, do we still care if SpringBoot 1.4.x can run CXF starters ? Even if we upgrade to 1.5.x they can still probably run with 1.4.x given that as far as API which CXF depends upon has not changed, but it would be worth confirming. 
> At the moment it appears that we should upgrade to 1.5.x if one of the following happens: 
> - 1.5.x users report some other issues blocking them from using CXF starters currently depending on 1.4.x
> - CXF starters gets enhanced to use 1.5.x features
> - 1.4.x becomes a legacy SpringBoot branch



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)