javaweb遇到的报错问题以及解决方案(持续更新)

javaweb报错问题以及解决方案

问题(报错信息):Application Server was not connected before run configuration stop, reason: javax.management.InstanceNotFoundException: Catalina:type=Server

解决方案:在使用idea启动tomcat的时候控制台报这个错误,原因是本机的8080端口被占用,在idea里把tomcat的启动端口从新换一个即可

问题(报错信息):org.apache.taglibs.standard.tlv.JstlCoreTLV

根本原因:缺少一个standard-1.1.2.jar

解决办法:在pom.xml中添加standard依赖

 <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.0.6</version>
    </dependency>

问题(报错信息):javax.el.PropertyNotFoundException: The class ‘java.lang.String’ does not have the property ‘id’.

原因:el表达式书写不正确

错误的jsp页面

<c:forEach items="list" var="carlist">
    <tr>
        <td>${carlist.id}</td>
        <td>${carlist.brand}</td>
        <td>${carlist.type}</td>
        <td>¥${carlist.price}</td>
        <td>
            <a href="delete?id=${carlist.id}" class="layui-btn layui-btn-normal">删除</a>
            <a href="alter?id=${carlist.id}" class="layui-btn layui-btn-normal">修改</a>
        </td>
    </tr>
</c:forEach>

正确的jsp页面

<c:forEach items="${list}" var="carlist">
    <tr>
        <td>${carlist.id}</td>
        <td>${carlist.brand}</td>
        <td>${carlist.type}</td>
        <td>¥${carlist.price}</td>
        <td>
            <a href="delete?id=${carlist.id}" class="layui-btn layui-btn-normal">删除</a>
            <a href="alter?id=${carlist.id}" class="layui-btn layui-btn-normal">修改</a>
        </td>
    </tr>
</c:forEach>

正确的el表达式应该是这样:${变量}

报错Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test

在spring-boot项目的ApplicationTests类中测试报这个错误
是因为@SpringBootTest注解没有指定classess属性的值
classess的值就是spring-boot项目的启动类

@SpringBootTest(classes = SsmcarApplication.class)
class SsmcarApplicationTests {

如果不指定还会报空指针异常
junit依赖建议使用与spring-boot结合的依赖

<dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
 </dependency>
报错:com.mysql.cj.exceptions.CJException: Access denied for user ‘root’@‘localhost’ (using password: YES)

springboot项目在配置数据源的时候应该在密码栏加上双引号,特别是以0开头的密码

datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://localhost:3306/ssm?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true
    username: root
    password: "password"
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值