我有一个使用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/