小BUG合集2

BUG1 No active profile set, falling back to default profiles: default

在日志中显示项目成功启动了,但项目却没能启动成功
在这里插入图片描述
在这里插入图片描述
然后新创建了两个项目也同样是这样的情况,在新创建的项目中,只有一个启动类和一个端口配置,其次就是pom文件。

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

解决:
将pom中的依赖换成.

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

BUG2 无法找到主启动类

STS、eclipse解决方案如下,idea原理也差不多
就是将项目位置配置一下就找得到了

2.1找到启动位置、右键;点击open config

在这里插入图片描述

2.2点击左边项目名、右边点击search配置一下位置,点击debug搞定

在这里插入图片描述在这里插入图片描述

2.2还有个可能,时子项目添加了心得pom依赖,而父项目中没有及时的更新或者添加

BUG3 java.lang.NoSuchMethodException: com.josion.export.pojo.Wares.stock(java.lang.Integer)

翻译:没有这样的方法异常

Method m = waresClass2.getDeclaredMethod("stock",Integer.class);

解决:方法名写成了字段名

Method m = waresClass2.getDeclaredMethod("setStock",Integer.class);

BUG3 使用resource包下非static存放的模板html文件时,使用File类在打包后无法正常使用页面

解决:

Resource resource = new ClassPathResource("templates/mail/mater.html");
		try {
			String str1 = IoUtil.read(resource.getInputStream(),CharsetUtil.UTF_8);
			return str1;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

BUG4 java.lang.OutOfMemoryError: GC overhead limit exceeded

解释:JDK新增错误类型。
当GC为释放很小空间占用大量时间时会抛出此异常
即(Sun 官方对此的定义:超过98%的时间用来做GC并且回收了不到2%的堆内存时会抛出此异常)。
一般是因为堆太小,导致异常的原因:没有足够的内存。

内存溢出,for循环数据太多、对象创建太多易导致

解决:
1、查看系统是否有使用大内存的代码或死循环。

2、可以添加JVM的启动参数来限制使用内存:-XX:-UseGCOverheadLimit

BUG5 SpringApplication cannot be resolved to a type

解决一:import org.springframework.boot.SpringApplication;
二:刷新maven

BUG6 端口号被占用The Tomcat connector configured to listen on port 60250 failed to start.The port may already be in use or the connector may be misconfigured.

明明在idea或者eclipose中停止了项目,但是页面能正常访问,重启时发现端口被占用。
解决一:
ctrl+alt+delete关闭进程
解决二:

1. 调出命令终端
win+r 并且输入cmd
 
2. 查看某个端口(60250)的被占用情况
netstat -ano |findstr 60250
 
3. 根据进程号(xxxxx)关闭进程即可
taskkill -PID xxxxx-F 

在这里插入图片描述

BUG7 can not import weborder from an existing workspsce folder

这次的问题并不是删除.project的原因,而是在打开项目时将工作空间打开成了项目,因处于项目的上一级为工作空间

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值