开发者社区 > 云原生 > 正文

com.alibaba.cloud.nacos.utils.UtilIPv6AutoConfigu

Nacos

版本:SpringBoot2.6.11 SpringCloud2021.0.4 SpringCloudAlibaba2021.0.4.0 Nacos2.0.4 环境:win10 jdk8 maven3.8.4

learn.first ticket-common 1.0-SNAPSHOT org.springframework.boot spring-boot-starter-mail org.springframework.boot spring-boot-starter-web org.projectlombok lombok io.springfox springfox-boot-starter 3.0.0 org.apache.httpcomponents httpclient

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-util</artifactId>
        <version>9.3.7.v20160115</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
    </dependency>

    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alicloud-oss</artifactId>
        <version>2.2.0.RELEASE</version>
    </dependency>

    <!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-spring-boot-starter</artifactId>
        <version>1.30.0</version>
    </dependency>
    <!-- Sa-Token 整合 Redis (使用jackson序列化方式) -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-dao-redis-jackson</artifactId>
        <version>1.30.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-pool2</artifactId>
    </dependency>
</dependencies>

common模块依赖

org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-actuator org.projectlombok lombok org.springframework.boot spring-boot-starter-test cn.hutool hutool-all

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-boot-starter</artifactId>
        <version>3.0.0</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
    </dependency>


    <dependency>
        <groupId>com.github.pagehelper</groupId>
        <artifactId>pagehelper-spring-boot-starter</artifactId>
        <version>1.4.3</version>
    </dependency>

    <!--spring-boot-starter-validation-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>

    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
    </dependency>
    <dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bootstrap</artifactId>
    </dependency>
    <!--openfeign服务远程调用-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-openfeign</artifactId>
    </dependency>
    <!--LoadBalancer负载均衡-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    </dependency>
    <!--sentinel服务熔断和降级-->
    <!--<dependency>
        <groupId>com.alibaba.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
    </dependency>
    &lt;!&ndash;sentinel-datasource-nacos sentinel规则做持久化到nacos配置中心用到&ndash;&gt;
    <dependency>
        <groupId>com.alibaba.csp</groupId>
        <artifactId>sentinel-datasource-nacos</artifactId>
    </dependency>-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.4</version>
    </dependency>

    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-spring-boot-starter</artifactId>
        <version>1.30.0</version>
    </dependency>
</dependencies>

application.yaml

server: port: 9005 spring: #邮箱配置 mail: #smtp服务主机 host: smtp.qq.com #配置端口号,默认的25端口在阿里云被禁用(需要申请开放,比较麻烦。改成587端口,465端口不能用) port: 587 #服务协议 protocol: smtp # 编码集 default-encoding: UTF-8 #发送邮件的账户 username: #授权码 password: test-connection: true properties: mail: smtp: auth: true starttls: enable: true required: true mvc: pathmatch: matching-strategy: ANT_PATH_MATCHER redis: # Redis数据库索引(默认为0) database: 0 # Redis服务器地址 host: 192.168.111.129 # Redis服务器连接端口 port: 6379 # ACL用户名 #username: # Redis服务器连接密码(默认为空) password: # 连接超时时间 timeout: 10s lettuce: pool: # 连接池最大连接数 max-active: 200 # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # 连接池中的最大空闲连接 max-idle: 10 # 连接池中的最小空闲连接 min-idle: 0

main: allow-bean-definition-overriding: true allow-circular-references: true

cloud: alicloud: access-key: secret-key: oss: endpoint: bucket: alicloud: #短信配置 sms: host: appcode: method: path:

bootstrap.yaml

spring: application: name: ticket-third-party cloud: nacos: server-addr: 192.168.111.129:8848 discovery: namespace: d44556f4-9541-4328-b579-6b4aee4a9840 group: DEV_GROUP server-addr: ${spring.cloud.nacos.server-addr} ip-type: IPv4 config: server-addr: ${spring.cloud.nacos.server-addr} namespace: d44556f4-9541-4328-b579-6b4aee4a9840 extension-configs: - group: DEV_GROUP refresh: true data-id: satoken.yaml

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-09-17 18:18:30.993 INFO 21168 --- [ main] c.a.alicloud.oss.OssApplicationListener : 0 OSSClients will be shutdown soon 2022-09-17 18:18:31.042 ERROR 21168 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 0 of method inetIPv6Util in com.alibaba.cloud.nacos.utils.UtilIPv6AutoConfiguration required a single bean, but 2 were found: - spring.cloud.inetutils-org.springframework.cloud.commons.util.InetUtilsProperties: defined in null - inetUtilsProperties: defined by method 'inetUtilsProperties' in class path resource [org/springframework/cloud/commons/util/UtilAutoConfiguration.class]

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

这个服务是做发送短信,发送邮箱,阿里云oss的,只有这个服务出现这个问题,其他服务没有出现。

使用SpringBoot2.6.3+SpringCloud2021.0.1+SpringCloudAlibaba2021.0.1.0+Nacos1.4.2时没有出现这个问题

我看了新版本的发布说明,新版本增加了服务的 IPv6 地址注册与调用能力,会不会和这个有关

原提问者GitHub用户 ovenfrank

展开
收起
云原生那些事 2023-06-07 16:14:58 1850 0
1 条回答
写回答
取消 提交回答
  • 找到问题了,我把这个oss的依赖由spring-cloud-starter-alicloud-oss换成aliyun-sdk-oss就好了

        <dependency>
            <groupId>com.aliyun.oss</groupId>
            <artifactId>aliyun-sdk-oss</artifactId>
            <version>3.15.1</version>
        </dependency>
    

    原回答者GitHub用户ovenfrank

    2023-06-07 16:16:39
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载