启动SpringBoot报错Input length = 1问题及解决

 更新时间:2023年05月12日 10:15:25   作者:xsqsharp  
这篇文章主要介绍了启动SpringBoot报错Input length = 1问题及解决方案,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教

启动SpringBoot报错Input length = 1问题

报错信息

maven-resources-plugin:3.2.0:resources (default-resources) on project jcy_interface_services: Input length = 1 -> [Help 1]

错误原因

maven,resource目录下配置文件的编码格式未设置。默认为GBK编码格式,需要在idea中设置编码为UTF-8。

解决办法

1.Settings---->File Encodings----> 凡是设计编码格式的选项全部修改为UTF-8

2.重启idea

3.重点注意:将原来配置文件中的注释删除,重新写上注释,否者还会出现乱码,无法运行。

解决一些Springboot启动报错问题

常见的两个原因

1、控制台信息如下

Connected to the target VM, address: ‘127.0.0.1:50617’, transport: ‘socket’
Disconnected from the target VM, address: ‘127.0.0.1:50617’, transport: ‘socket’
Process finished with exit code 0  

原因是某个 .xml文件 被注释 释放即可,!

2、报错信息如下

org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.0.6.RELEASE.jar:5.0.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at com.ecjtu.demo.DemoApplication.main(DemoApplication.java:15) [classes/:?]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:409) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:174) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    ... 8 more
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:172) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:110) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:409) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:174) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.2.RELEASE.jar:2.0.2.RELEASE]
    ... 8 more

1、首先得去看配置文件application.yml,pom.xml,程序入口类。这三个

2、把@EnableEurekaServer注解和关于eureka的配置都去掉 如果可以跑起来 就去引入jaxb-api;

注:从java9开始,模块化的概念使JAXB默认没有加载;jaxb-api是存在jdk中的,只是默认没有加载而已,我们需要手动引入。要问这个jaxb-api是什么作用 大家可以去百度一下

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • Maven直接依赖、间接依赖、依赖冲突、依赖仲裁的实现

    Maven直接依赖、间接依赖、依赖冲突、依赖仲裁的实现

    本文主要介绍了Maven直接依赖、间接依赖、依赖冲突、依赖仲裁的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2023-09-09
  • 详解Spring Boot 事务的使用

    详解Spring Boot 事务的使用

    spring Boot 使用事务非常简单,首先使用注解 @EnableTransactionManagement 开启事务支持后,然后在访问数据库的Service方法上添加注解 @Transactional 便可。接下来通过本文重点给大家介绍spring boot事务的使用,需要的的朋友参考下吧
    2017-04-04
  • SpringBoot项目启动报错"找不到或无法加载主类"的解决方法

    SpringBoot项目启动报错"找不到或无法加载主类"的解决方法

    在使用 IntelliJ IDEA 开发基于 Spring Boot 框架的 Java 程序时,可能会出现找不到或无法加载主类 com.example.springboot.SpringbootApplication的错误提示,下面我们来看看如何解决吧
    2025-03-03
  • 深入学习Java编程中的字符串的进阶使用

    深入学习Java编程中的字符串的进阶使用

    这篇文章主要介绍了Java编程中的字符串的高级运用,包括StringBuffer类和StringTokenizer类以及常量池的介绍,需要的朋友可以参考下
    2016-01-01
  • java8 forEach结合Lambda表达式遍历 List操作

    java8 forEach结合Lambda表达式遍历 List操作

    这篇文章主要介绍了java8 forEach结合Lambda表达式遍历 List操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2020-09-09
  • springMVC+ajax实现文件上传且带进度条实例

    springMVC+ajax实现文件上传且带进度条实例

    本篇文章主要介绍了springMVC+ajax实现文件上传且带进度条实例,具有一定的参考价值,有兴趣的可以了解一下。
    2017-01-01
  • Security中的WebSecurityConfigurerAdapter详解

    Security中的WebSecurityConfigurerAdapter详解

    这篇文章主要介绍了Security中的WebSecurityConfigurerAdapter详解,今天我们要进一步的的学习如何自定义配置Spring Security,本文结合实例代码给大家介绍的非常详细,需要的朋友可以参考下
    2023-07-07
  • MyBatis中useGenerateKeys的使用解析

    MyBatis中useGenerateKeys的使用解析

    这篇文章主要介绍了MyBatis中useGenerateKeys的使用,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2021-09-09
  • Java中的异常处理之try-catch使用详解

    Java中的异常处理之try-catch使用详解

    这篇文章主要介绍了Java中的异常处理之try-catch使用的相关资料,包括异常的概念、try-catch语句的基本结构、使用示例、多个catch块的使用、try-catch-finally的执行顺序、try-with-resources语句以及总结,需要的朋友可以参考下
    2024-12-12
  • java编程Reference核心原理示例源码分析

    java编程Reference核心原理示例源码分析

    这篇文章主要为大家介绍了java编程Reference的核心原理以及示例源码分析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步早日升职加薪
    2022-01-01

最新评论