0

我正在尝试按照本指南在 Heroku 上部署Spring Boot应用程序:http: //codingricky.com/booting-spring-boot-into-heroku/(感谢 Ricky Yim)

看起来很简单,但我的应用程序包含依赖项integration.xml所需的一个:spring-messaging

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-messaging</artifactId>
    </dependency>

话虽如此,我不Spring Integration只是使用 websockets / STOMP 消息传递。所以需要依赖。

当应用程序尝试启动时,我收到一个简单的未找到错误:

Caused by: java.io.FileNotFoundException: class path resource [integration.xml] cannot be opened because it does not exist

本地integration.xml位于目录中,当我来自 Eclipse/src/main/resource时位置很好。run as -> spring boot

我还有一个单页 html 和一些 javascript 文件来调试 websockets / STOMP 消息,就像这里的指南:https ://spring.io/guides/gs/messaging-stomp-websocket/

我需要更改什么,以便应用程序/resource在部署为 jar 时可以在目录中找到这些文件?

4

1 回答 1

2

如果您使用 Maven 和默认设置构建您的 JAR,您应该会发现“src/main/resources”中的所有内容都位于 JAR 的根目录中,因此如果您使用“java -jar”运行,则位于类路径中。我不知道 Heroku buildpack 如何运行 JAR(它是使用“java -jar”还是解压它并做一些不同的事情?)所以答案可能就在那里。

如果您可以在本地运行您的 JAR 文件,我希望它可以在 PaaS 上运行,但谁知道他们在运行时可能会对它做什么。

顺便说一句,“spring-messaging”不需要任何 XML 配置,因此您可能应该研究一下并尝试了解错误消息的实际来源。如果你在 github 上分享你的项目,那么建议你可能做错了什么会容易得多。

于 2014-01-30T10:42:23.293 回答