遇见的问题及解决

1、跨域问题

1.1、

情况:
在这里插入图片描述原因: 通过一个地址去访问另外一个地址,这个过程如果有一个地址的端口号不一样就会引发
解决方式:

  1. 在后端接口controller中添加注解@CrossOrigin
  2. 使用网关

2、APPLICATION FAILED TO START(应用程序无法启动)

2.1

情况:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

原因: 启动的时候程序会找数据库的配置,但是这个模块不需要操作数据库,只是实现上传到oss的功能,所以没有配置数据库导致报错。
解决方式:

  1. 添加数据库配置
  2. 在启动类上添加属性,默认不去加载数据库
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

3、BindingException

3.1、

情况: 项目中创建mapper接口,编写xml文件sql语句,执行出错

ibatis.binding.BindingException:Invalid bound statement(not found)

原因: maven默认加载机制造成
解决方式:

  1. 复制xml到target目录中;
  2. 把xml文件放到resources目录中;
  3. 配置pom.xml和application.properties文件
<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
        <filtering>false</filtering>
    </resource>
</resources>
mybatis-plus.mapper-locations=classpath:com/czq/eduservice/mapper/xml/*.xml

4、413错误

4.1、

情况:
在这里插入图片描述
原因: 请求体过大
**解决方式:**在nignx配置文件中配置

http {
    ...
	client_max_body_size 1024m;
	...
}

5、IllegalArgumentException

5.1、

情况: 引入服务注册中心nacos

java.lang.IllegalArgumentException: no server available

原因: 引入依赖后没有在启动类上加上@EnableDiscoveryClient注解以及配置类中没有配置
**解决方式:**加上注解并配置

#nacos服务地址
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848

6、Process terminated

6.1、

情况:

[error]Project 'com.czq:service_admin:0.0.1-SNAPSHOT' is duplicated in the reactor 

原因: 父辈中定义了多个子module,在父的module的pom.xml中定义了这个关系,子module的pom.xml中将子module的同级或者父辈作为自己的子module,出现了冲突。
**解决方式:**删掉相应的依赖

7、vue.runtime.esm.js:587 [Vue warn]: Error in event handler for “click”: “ReferenceError: xxx is not defined”

情况:

vue.runtime.esm.js:587 [Vue warn]: Error in event handler for "click": "ReferenceError: user is not defined"

原因: 没有引用相应的组件

**解决方式:**引入相关组件

import user from "@/api/pet/user";

8、org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans’ defined in class path resource…

原因: spring boot与nacox版本不一致

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值