后端报错集合

一、程序包org.apache.ibatis.io不存在和测试报错:Class not found:
初次使用mybatis时,发现找不到部分包的问题
在这里插入图片描述

我们可以进行以下操作:
在这里插入图片描述
执行mvn idea:idea
或者mvn idea:module
在这里插入图片描述
然后就搞定了。

二、当发现IDEA Maven测试报错:Class not found:“ “
把项目的.iml删除再运行即可。
在这里插入图片描述

三、
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

四、父工程下的子工程相互调用时失败
Maven异常:Could not find artifact
对父工程
在这里插入图片描述
五、
ailed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class

在这里插入图片描述
没有成功打包到target下,pom

	<resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.yml</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>

然后
在这里插入图片描述

六、找不到或无法加载主类
删除target,执行:
在这里插入图片描述

七、springboot项目中target没用同步更新代码
pom:

<build>    
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.*</include>
                </includes>
            </resource>
        </resources>
</build>

在这里插入图片描述

八、在这里插入图片描述
修改maven-resources-plugin的版本

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <!-- 增加以下部分 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
            </plugin>

        </plugins>
    </build>

九、
根据一些其他的教程,我们找到要想实现导入配置文件处理器,配置文件进行绑定就会有提示,需要在pom.xml文件中加入下面的语句

<!--导入配置文件处理器,在编写配置文件时就会提示--> 
        <dependency> 
            <groupId>org.springframework.boot</groupId> 
            <artifactId>spring-boot-configuration-processor</artifactId> 
            <optional>true</optional> 
        </dependency>

但发现运行了测试类后还是没有出来,这是就要去看看是不是自己写了一些自己定义的类,这是我们需要在自己写的类前面加上

@Component
@ConfigurationProperties(prefix = "***")

即可

十、
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘POST’ not supported]
在这里插入图片描述
在这里插入图片描述
解决办法:
在application.properties配置文件中加

十一、Spring Boot Configuration Annotation Processor not configured
在这里插入图片描述
意思是“Spring Boot配置注解执行器没有配置”。
配置注解执行器配置完成后,当执行类中已经定义了对象和该对象的字段后,在配置文件中对该类赋值时,便会非常方便的弹出提示信息。
在pom加上

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-configuration-processor</artifactId>
    <optional>true</optional>
</dependency>

十二.secret key byte array cannot be null or empty.
签名秘钥不能太短,不少与4个字符

十三、版本爆红
更新maven仓库的settings.xml:

<mirror>
  <id>aliyunmaven</id>
  <mirrorOf>*</mirrorOf>
  <name>阿里云公共仓库</name>
  <url>https://maven.aliyun.com/repository/public</url>
</mirror>

在这里插入图片描述
关闭后重新打开idea

十四、The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing

git clone https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin.git
cd dummy-lifecycle-mapping-plugin/
mvn -Dmaven.test.skip -U clean install

十五、父子工程找不到启动类

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:repackage (repackage) on project lx-cloud-oauth2-base: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.2.2.RELEASE:repackage failed: Unable to find main class

在父工程的pom加入

<!--springboot 打包插件-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!--启动类   父工程找不到子工程的时候-->
                <configuration>
                    <mainClass>com.lx.oauth2.AuthServerApplication</mainClass>
                </configuration>
            </plugin>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值