加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

无法启动springboot应用程序 – 资源位置不能为空

发布时间:2020-12-15 01:32:19 所属栏目:大数据 来源:网络整理
导读:第一次尝试springboot,但我无法启动它. 我使用了示例应用程序:https://github.com/spring-guides/gs-spring-boot.git 我还修改了使用嵌入式jetty而不是tomcat,但仍然没有成功. 我得到的例外是:org.springframework.context.ApplicationContextException:

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

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

这是在MacOSX上.

编辑:我已经确认这是一个环境问题.我可以在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 VM中工作正常.
没有时间深入研究这个问题,也许其他人可以更轻松一点.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读