gradle - Wildfly无法启动可部署的War文件

标签 gradle spring-boot war wildfly

我有一个使用Spring Integration执行SFTP轮询的Spring Boot应用程序...

我正在尝试按照此guide打包jar文件并将其作为war文件部署到wildfly 8.2应用程序服务器。我使用的gradle插件仅允许部署war或ear文件。

因此,为完成此任务,我在本地使用嵌入式tomcat运行,并且完美运行,但是当我进行远程测试时,该应用已部署但从未启动。

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Stasher extends SpringBootServletInitializer implements WebApplicationInitializer {

private static Class<Stasher> applicationClass = Stasher.class;

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
         return application.sources(applicationClass);
    }


    public static void main(String[] args) {
        System.out.println("MAIN STARTED ***************************");
        SpringApplication.run(Stasher.class, args);
    }
}

Wildfly 8.2的日志
19:12:35,347 INFO  [org.springframework.jmx.export.annotation.AnnotationMBeanExporter] (MSC service thread 1-4) Registering beans for JMX exposure on startup
19:12:35,352 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (MSC service thread 1-4) Starting beans in phase -2147483648
19:12:35,353 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (MSC service thread 1-4) Starting beans in phase 0
19:12:35,353 INFO  [org.springframework.integration.endpoint.EventDrivenConsumer] (MSC service thread 1-4) Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
19:12:35,353 INFO  [org.springframework.integration.channel.PublishSubscribeChannel] (MSC service thread 1-4) Channel 'Stasher-Default.errorChannel' has 1 subscriber(s).
19:12:35,353 INFO  [org.springframework.integration.endpoint.EventDrivenConsumer] (MSC service thread 1-4) started _org.springframework.integration.errorLogger
19:12:35,359 INFO  [org.springframework.boot.SpringApplication] (MSC service thread 1-4) Started application in 1.695 seconds (JVM running for 11619.131)
19:12:35,361 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017534: Registered web context: /Stasher
19:12:35,439 INFO  [org.jboss.as.server] (management-handler-thread - 1) JBAS018559: Deployed "Stasher.war" (runtime-name : "Stasher.war")

为什么在Wildfly中无法启动主管道?

最佳答案

这是在应用服务器中启动Spring Boot应用时使用的configure方法。仅当您使用main将应用程序作为可执行存档启动应用程序时,才使用java -jar方法。

关于gradle - Wildfly无法启动可部署的War文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30310133/

相关文章:

java - 主要来源内的 Gradle 测试

java - UnsupportedOperationException : No format processor for org. jboss...发现 MavenResolvedArtifact

java - Spring Data Elasticsearch文档未反序列化

java - 部署spring boot应用需要web.xml吗

java - 在容器而不是 web.xml 中指定身份验证

java - 编译时在 gradle 中收到 support-v7 :25. 1.0 错误

java - Gradle 子项目无法识别根 build.gradle 中的第 3 方依赖项

java - 在 Spring 中传递 Bean 依赖项的最佳方式是什么

java - Spring Autowiring : Caused by: java. lang.IllegalArgumentException:无法设置空TableModel

java - 单次 war 部署的多上下文根 jboss-EAP-6.1