Spring boot 开发WebService遇到的问题之一
当pom.xml文件中的配置:
<artifactId>spring-boot-starter-parent</artifactId><version>2.0.6.RELEASE</version>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId><version>3.2.6</version>
parent版本是2.0.4,同时jaxws版本是3.2.6时;
parent版本是2.0.5,同时jaxws版本是3.2.6时;
parent版本是2.0.6,同时jaxws版本是3.2.6时;
parent版本是2.1.0,同时jaxws版本是3.2.6时;
parent版本是2.0.6,同时jaxws版本是3.1.11时;
会出现以下错误:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.6.RELEASE)
2018-11-20 10:10:14.858 INFO 230600 --- [ main] com.dk.root.Dk20181120Application : Starting Dk20181120Application on Jerry-PC with PID 230600 (started by Jerry in G:\东科20180920\projects\dk20181120)
2018-11-20 10:10:14.860 INFO 230600 --- [ main] com.dk.root.Dk20181120Application : No active profile set, falling back to default profiles: default
2018-11-20 10:10:14.885 INFO 230600 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@214b199c: startup date [Tue Nov 20 10:10:14 CST 2018]; root of context hierarchy
2018-11-20 10:10:15.383 WARN 230600 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2018-11-20 10:10:15.388 INFO 230600 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-20 10:10:15.451 ERROR 230600 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration required a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'dispatcherServletRegistration' in 'DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration' not loaded because DispatcherServlet Registration found non dispatcher servlet dispatcherServlet
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath' in your configuration.
当
parent版本是1.4.5,同时jaxws版本是3.1.7时;
parent版本是1.4.5,同时jaxws版本是3.1.11时;
parent版本是1.5.6,同时jaxws版本是3.1.11时;
parent版本是1.5.8,同时jaxws版本是3.1.12时;
parent版本是1.5.9,同时jaxws版本是3.1.11时;
parent版本是1.5.9,同时jaxws版本是3.1.12时;
parent版本是2.0.3,同时jaxws版本是3.2.6时;
则运行正常。
目前只尝试了这几种版本,分析认为应该是parent版本造成的问题。其他版本配合待尝试。