无法启动 Spring Boot 应用程序 - 资源位置不能为空

2024-04-05

第一次尝试springboot,但无法启动。 我使用了示例应用程序:https://github.com/spring-guides/gs-spring-boot.git https://github.com/spring-guides/gs-spring-boot.git我还进行了修改以使用嵌入式码头而不是 tomcat,但仍然没有成功。

我得到的异常是这样的:org.springframework.context.ApplicationContextException:无法启动嵌入式容器;嵌套异常是 java.lang.IllegalArgumentException:资源位置不能为空。

这是在 MacOS 上。

编辑:我已经确认这是一个环境问题。我可以在 linux(fedora) VM 中正常启动该应用程序,但无论出于何种原因,我在 Mac 上遇到了这个问题。不确定是否有其他人遇到过这种情况,并有任何线索可能导致这种情况。

编辑 2:所以这似乎是尝试默认配置 ssl 的问题。我不确定为什么会出现这种情况,因为我没有在任何地方指定这一点;所以我现在的问题是,如何在 spring-boot 中禁用 https?

mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T09:29:23-08:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"

任何帮助表示赞赏。

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.IllegalArgumentException: Resource location must not be null
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at hello.Application.main(Application.java:15) [classes!/:0.1.0]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
    at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [gs-spring-boot-0.1.0.jar:0.1.0]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [gs-spring-boot-0.1.0.jar:0.1.0]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [gs-spring-boot-0.1.0.jar:0.1.0]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58) [gs-spring-boot-0.1.0.jar:0.1.0]
Caused by: java.lang.IllegalArgumentException: Resource location must not be null
    at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
    at org.springframework.util.ResourceUtils.getURL(ResourceUtils.java:131) ~[spring-core-4.3.4.RELEASE.jar!/:4.3.4.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureSslKeyStore(TomcatEmbeddedServletContainerFactory.java:417) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.configureSsl(TomcatEmbeddedServletContainerFactory.java:395) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.customizeSsl(TomcatEmbeddedServletContainerFactory.java:332) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.customizeConnector(TomcatEmbeddedServletContainerFactory.java:311) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:169) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.2.RELEASE.jar!/:1.4.2.RELEASE]
    ... 16 common frames omitted

添加:server.ssl.enabled=false在我的 application.properties 中解决了这个问题。我假设 ssl 配置是基于父启动启动器 pom 的预期?再次,不确定为什么这在 Linux 虚拟机中运行良好。 没有时间深入研究这个问题,也许其他人可以提供更多信息。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法启动 Spring Boot 应用程序 - 资源位置不能为空 的相关文章

随机推荐

  • 如何在面板数据中为不同年份创建单独的直方图?

    我有一个数据框报纸 年 其中包含每年一组报纸的发行量 CIRC 我想看看这些数字的分布如何随时间变化 所以我想为这些不同的年份创建多个单独的直方图 我已经尝试过以下方法 ggplot newspaper yearly aes x CIRC
  • YouTube URL 方案 tvOS

    我正在尝试使用 URL 方案或 YouTube com 域从我的应用程序打开 YouTube 的应用程序 从而直接在 iOS 设备上打开 YouTube 的应用程序 这是我尝试过的代码 UIApplication sharedApplica
  • 如何访问shinyapps.io上应用程序的R+Shiny代码?

    我发现了一个设计非常好的闪亮应用程序闪亮应用程序io https wuli shinyapps io QuoiR 网站 但我不知道如何访问它R代码或说出github其代码目录 我发现如果我们能够访问它的代码 这非常有启发性 无论如何 在最坏
  • SQLAlchemy 布尔值与 BOOLEAN 的比较

    我理解了BOOLEAN覆盖 visit name class BOOLEAN Boolean visit name BOOLEAN 控制调度程序选择的访问者方法 def compiler dispatch self visitor kw v
  • Java 编写单元测试,用于当用户在控制台中键入 quit 时退出程序

    我发现很难为这种方法编写单元测试 当用户键入退出命令时 它基本上会退出程序 系统退出类 public class SystemExit public void exit int status System exit status 我的静态方
  • 如何制作圆形按钮?

    我想制作一个圆形按钮 但我不知道该怎么做 我可以制作带有圆角的按钮 但是我怎样才能制作圆形 这是不一样的 请问一下 安卓上可以吗 谢谢 创建一个名为的 xml 文件roundedbutton xml在可绘制文件夹中
  • 为什么 cv2.rectangle 有时返回 np.ndarray,而有时返回 cv2.UMat

    我目前正在研究一些图像的可视化 并发现 opencv 的 cv2 rectangle 的奇怪行为 当输入图像是 np ndarray 时 例如 arr cv2 rectangle 返回一个 np ndarray 并且 arr 是用矩形绘制的
  • 如何禁用默认消息:“您的请求已成功处理”?

    当在我的 portlet 中执行添加 更新操作时 如何为我的插件 portlet 禁用此默认消息 您的请求已成功处理 另外我想为我的自定义配置页面禁用此功能 configuration jsp 这是当我们单击每个 Portlet 右上角出现
  • 这个“你好世界!”是怎么做到的?程序工作?

    int main void return yes no main printf hello world n 0 outputs hello world 但它实际上是如何工作的呢 确实有两件事 函数指针不像其他指针那样取消引用 main ma
  • Powershell - 排除 Get-ChildItem 中的文件夹

    如何排除文件夹 现在我对文件夹名称进行硬编码 但我希望它更加灵活 foreach file in Get ChildItem fileDirectory Exclude folderA folderb 如何排除文件夹 如果您指的是所有文件夹
  • libpcap 在它们下面使用原始套接字吗?

    我对原始套接字和 libcap 的使用感到有点困惑 任何人都可以简单地指出使用两者的优点 我读了几个链接 但是 它让我感到困惑 libpcap 在不同的操作系统上使用不同的机制 在 Linux 上 它使用 PF PACKET 原始套接字或熟
  • 如何根据 Mongodb 中的键删除重复项?

    我在 MongoDB 中有一个集合 其中大约有 约 300 万条记录 我的样本记录看起来像 id ObjectId 50731xxxxxxxxxxxxxxxxxxxx source references id ObjectId 5045xx
  • 为什么“OR 运算”或 OR 条件不可控制?

    在文献中 我读到在 WHERE 子句中使用 OR 条件或运算符会生成一个语句non sargable 我不确定为什么或如何这是真的 任何帮助 将不胜感激 权威优化书籍作者给出了答案SQL Server 查询性能调优 https rads s
  • 创建动画按钮

    我有按钮可以在单击时创建动画吗 使用 Photoshop 我创建了两个图像 启用和禁用 在Windows窗体中插入图片框并单击事件 单击图像从启用变为禁用 但是可以有动画吗 像这样 看来您提到了 WinForms 所以我将解决这个问题 是的
  • 测试元素焦点

    我如何检查这个TextInput组件是否受到关注 我知道该怎么做在网上 https spectrum chat testing library general how to test element is focused 7Eabdca78
  • PHP 循环内循环,选择了选项吗?

    使用 PHP 我在循环中回显表行 如下所示
  • 如何使用 $dateFromString 转换数组中的日期?

    我正在尝试使用 dateFromString 将数组中的时间戳转换为日期 我试图从中转换日期的示例文档 id ObjectId 5cbc5efc8af5053fd8bdca31 ticker ticker currency currency
  • Java分割字符串的表现

    这是我的应用程序中的当前代码 String ids str split 在分析应用程序时 字符串分割花费了不可忽视的时间 另外 split方法采用正则表达式 这在这里是多余的 我可以使用什么替代方法来优化字符串分割 是StringUtils
  • 无法使用 Maven 中的配置文件和属性构建适配器

    我已经使用创建了一个http适配器mfpdev adapter create但我发现 adatper xml 配置文件包含服务器连接配置 我想相应地更改为 dev test produciton 环境 所以我尝试通过更改 pom xml 来
  • 无法启动 Spring Boot 应用程序 - 资源位置不能为空

    第一次尝试springboot 但无法启动 我使用了示例应用程序 https github com spring guides gs spring boot git https github com spring guides gs spr