You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Auke van Leeuwen (JIRA)" <ji...@apache.org> on 2017/11/09 14:52:00 UTC

[jira] [Comment Edited] (CXF-7555) Failure to construct bean of org.apache.cxf.jaxrs.spring.SpringViewResolverProvider

    [ https://issues.apache.org/jira/browse/CXF-7555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16245762#comment-16245762 ] 

Auke van Leeuwen edited comment on CXF-7555 at 11/9/17 2:51 PM:
----------------------------------------------------------------

I have the following logs related to the wiring of this class:

{noformat}
2017-11-09 15:29:29.443 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'cxf.jaxrs.classes-scan' in any property source
2017-11-09 15:29:29.443 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cxf.jaxrs.component-scan' in PropertySource 'applicationConfigurationProperties' with value of type Boolean
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cxf.jaxrs.component-scan' in PropertySource 'applicationConfigurationProperties' with value of type Boolean
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'cxf.jaxrs.classes-scan' in any property source
2017-11-09 15:29:29.459 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.465 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
2017-11-09 15:29:29.465 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : JSR-330 'javax.inject.Named' annotation found and supported for component scanning
2017-11-09 15:29:29.466 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Resolved classpath location [org/apache/cxf/jaxrs/spring/] to resources [URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/]]
2017-11-09 15:29:29.466 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Looking for matching resources in jar file [file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar]
2017-11-09 15:29:29.469 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Resolved location pattern [classpath*:org/apache/cxf/jaxrs/spring/**/*.class] to resources [URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractJaxrsClassesScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractSpringComponentScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractSpringConfigurationFactory.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean$1.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JaxRsConfig.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/NamespaceHandler.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringComponentScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringJaxrsClassesScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringResourceFactory.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringViewResolverProvider.class]]
2017-11-09 15:29:29.473 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : Identified candidate component class: URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringViewResolverProvider.class]
{noformat}

I've tried to attach a remote debugger to it and it seems to be going as follows:

{{org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration}} is a Spring Boot autoconfiguration class 
→ has a nested {{org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration.JaxRsComponentConfiguration}} class 
→ imports {{org.apache.cxf.jaxrs.spring.SpringComponentScanServer}} 
→ which has a {{@ComponentScan}} and scans everything under {{org.apache.cxf.jaxrs.spring}} by default because it doesn't have an configuration for {{basePackages}} or {{basePackageClasses}}.



was (Author: aukevanleeuwen):
I have the following logs related to the wiring of this class:

{noformat}
2017-11-09 15:29:29.443 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'cxf.jaxrs.classes-scan' in any property source
2017-11-09 15:29:29.443 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cxf.jaxrs.component-scan' in PropertySource 'applicationConfigurationProperties' with value of type Boolean
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'cxf.jaxrs.component-scan' in PropertySource 'applicationConfigurationProperties' with value of type Boolean
2017-11-09 15:29:29.458 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'cxf.jaxrs.classes-scan' in any property source
2017-11-09 15:29:29.459 DEBUG [payment-service,,,] 98756 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Returning cached instance of singleton bean 'autoConfigurationReport'
2017-11-09 15:29:29.465 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
2017-11-09 15:29:29.465 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : JSR-330 'javax.inject.Named' annotation found and supported for component scanning
2017-11-09 15:29:29.466 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Resolved classpath location [org/apache/cxf/jaxrs/spring/] to resources [URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/]]
2017-11-09 15:29:29.466 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Looking for matching resources in jar file [file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar]
2017-11-09 15:29:29.469 DEBUG [payment-service,,,] 98756 --- [           main] .i.s.PathMatchingResourcePatternResolver : Resolved location pattern [classpath*:org/apache/cxf/jaxrs/spring/**/*.class] to resources [URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractJaxrsClassesScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractSpringComponentScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/AbstractSpringConfigurationFactory.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean$1.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser$SpringJAXRSServerFactoryBean.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/JaxRsConfig.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/NamespaceHandler.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringComponentScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringJaxrsClassesScanServer.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringResourceFactory.class], URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringViewResolverProvider.class]]
2017-11-09 15:29:29.473 DEBUG [payment-service,,,] 98756 --- [           main] o.s.c.a.ClassPathBeanDefinitionScanner   : Identified candidate component class: URL [jar:file:/Users/avanleeuwen/.m2/repository/org/apache/cxf/cxf-rt-frontend-jaxrs/3.2.1/cxf-rt-frontend-jaxrs-3.2.1.jar!/org/apache/cxf/jaxrs/spring/SpringViewResolverProvider.class]
{noformat}

I've tried to attach a remote debugger to it and it seems to be going as follows:

{{org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration}} is a Spring Boot autoconfiguration class 
→ has a nested {{org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration.JaxRsComponentConfiguration}} class 
→ imports {{org.apache.cxf.jaxrs.spring.SpringComponentScanServer}} 
→ which component scans everything under {{org.apache.cxf.jaxrs.spring}} by default because it doesn't have an configuration for {{basePackages}} or {{basePackageClasses}}.


> Failure to construct bean of org.apache.cxf.jaxrs.spring.SpringViewResolverProvider
> -----------------------------------------------------------------------------------
>
>                 Key: CXF-7555
>                 URL: https://issues.apache.org/jira/browse/CXF-7555
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.1
>            Reporter: Auke van Leeuwen
>
> I'm using the {{cxf-spring-boot-starter-jaxrs}} module in my project that is exposing a RESTful API. However upgrading from {{3.2.0}} to {{3.2.1}} broke my application:
> {noformat}
> ***************************
> APPLICATION FAILED TO START
> ***************************
> Description:
> Parameter 1 of constructor in org.apache.cxf.jaxrs.spring.SpringViewResolverProvider required a bean of type 'org.springframework.web.servlet.LocaleResolver' that could not be found.
> 	- Bean method 'localeResolver' in 'WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter' not loaded because @ConditionalOnProperty (spring.mvc.locale) did not find property 'locale'
> {noformat}
> It seems like {{org.apache.cxf.jaxrs.spring.SpringViewResolverProvider}} was introduced in {{3.2.1}} but that assumes that I'm *also* using Spring MVC, which I don't.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)