The errors encountered in writing as service items today are shown below. I only know that the creation of error creating bean with name ‘servletendpointregistrar’ defined in class path resource failed. I also found some solutions on the Internet. The most common solutions are that there is a lack of JDBC dependency, or that the database configuration file is wrong. I also compared the database, There is no lack of JDBC dependency, which shows that my database and dependency are correct. I compared other service services and found that more configuration files were introduced into the configuration file
[${project.name}] 2021-09-10 23:21:44,213 ERROR [localhost-startStop-1][Jdk14Logger.java:87] - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]: Unsatisfied dependency expressed through method 'servletEndpointRegistrar' parameter 0; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties': Could not bind properties to 'WebEndpointProperties' : prefix=management.endpoints.web, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'management.endpoints.web.exposure' to org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties$Exposure
[${project.name}] 2021-09-10 23:21:44,240 WARN [main][Jdk14Logger.java:87] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
[${project.name}] 2021-09-10 23:21:44,241 INFO [main][DubboGenericServiceFactory.java:159] - The Dubbo GenericService ReferenceBeans are destroying...
[${project.name}] 2021-09-10 23:21:44,245 INFO [main][Jdk14Logger.java:87] - class org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor was destroying!
My Nacos profile is
#HTTP format configuration spring:
http:
encoding:
charset: UTF‐8
force: true
enabled: true
messages:
encoding: UTF‐8
#tomcat header information (user ip and access protocol) and access path configuration
server:
tomcat:
remote_ip_header: x‐forwarded‐for
protocol_header: x‐forwarded‐proto
servlet:
context‐path: /lifly
use‐forward‐headers: true
#Service monitoring and management configuration, operation and maintenance related
management:
endpoints:
web:
exposure:
include: refresh,health,info,env
This configuration file defines the user IP and access path, as well as some configuration files related to service monitoring, management and operation and maintenance. However, the remote call is not used in the service, but I introduced this configuration file. The reason for my error is this, so I recorded it
My bootstrap.yml configuration file is as follows:
server:
port: 56050
nacos:
server:
addr: 127.0.0.1:8848
spring:
application:
name: transaction-service
# main:
# allow-bean-definition-overriding: true # Spring Boot 2.1
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
# server-addr: ${nacos.server.addr}
namespace: 339eea59-f7f4-44d0-a3fa-9f1f85bd5b4f
# cluster-name: COMMON_GROUP
config:
server-addr: 127.0.0.1:8848
# server-addr: ${nacos.server.addr}
file-extension: yaml
namespace: 339eea59-f7f4-44d0-a3fa-9f1f85bd5b4f
group: DEFAULT_GROUP
ext-config:
-
refresh: true
data-id: spring-boot-http.yaml # spring boot http
group: COMMON_GROUP
# -
# refresh: true
# data-id: spring-boot-starter-druid.yaml # spring boot starter druid
# group: COMMON_GROUP
# -
# refresh: true
# data-id: spring-boot-mybatis-plus.yaml # spring boot mybatisplus
# group: COMMON_GROUP
# - refresh: true
# data-id: spring-boot-redis.yaml
# group: COMMON_GROUP
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/huiminpay_transaction?useUnicode=true&useSSL=false
# url: jdbc:mysql://localhost:3306/huiminpay_merchant_service?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&useUnicode=true
username: root
password: 1234
mybatis-plus:
type-aliases-package: com.huiminpay.transaction.entity
mapper-locations: classpath:/mapper/*.xml
dubbo:
scan:
# dubbo
base-packages: com.huiminpay
protocol:
# dubbo 协议
name: dubbo
port: 20893
registry:
address: nacos://127.0.0.1:8848
application:
qos:
port: 22250 # dubbo qos
consumer:
check: false
timeout: 3000
retries: -1
logging:
config: classpath:log4j2.xml
I commented out the import file and the project started. Record it again, and I hope it will be helpful to you. Comment out the following import file
ext-config:
-
refresh: true
data-id: spring-boot-http.yaml # spring boot http set
group: COMMON_GROUP