Springboot项目错误二

1、

This application has no explicit mapping for /error, so you are seeing this as a fallback.There was an unexpected error (type=Not Found, status=404).

如果出现此错误,查看是否需要@ResponseBody注解

原因:不加@ResponseBody代表返回一个视图,加上注解的话代表返回数据,如果返回数据时不加,也会出现404

 

2、[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:repackage (repackage) on project shopping-mall-spi: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:repackage failed: Unable to find main class -> [Help 1]

我在打包spi(spi为我的接口包)时,报这个错,原因是因为此包只是一个接口包,不应该加入spring-boot-maven-plugin打包插件,在pom文件中去掉即可

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

 

 具体报错的图片

3、nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productName' in 'class java.lang.String'] with root cause

org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productName' in 'class java.lang.String'

整合mybatis时,dao层中的文件要添加@Param注解,否则就会报这个错

List<ProductPO> searchProduct(@Param("productName") String productName);

4、org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration': Unsatisfied dependency expressed through field 'eurekaServerBootstrap'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaServerBootstrap' defined in class path resource

如果是用的2.0版本以上的springboot时,使用eureka时,除了导入eureka的包以外,还需要导入hystrix的包

​<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-netflix-eureka-server</artifactId>
  <version>2.0.0.RELEASE</version>
</dependency>
<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
  <version>2.0.0.RELEASE</version>
</dependency>

​

或者直接导入eureka和hystrix合体的包

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>

 

 5、ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext

springboot使用的是2.0以上的版本,rureka客户端引用eureka-client的包的版本太低,换成2.0.0-RELEASE版本

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  <version>2.0.0.RELEASE</version>
</dependency>

6、Failed to collect dependencies at org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.21.RELEASE:

错误:版本使用不对,注意springboot和springboot-starter-data-jpa的版本需要进行搭配一致;

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值