[英]Wildfly not starting a deployable war file
我有一个使用Spring Integration进行SFTP轮询的Spring Boot应用程序...
我试图按照本指南打包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
方法。 仅当使用java -jar
将应用程序作为可执行存档启动应用程序时,才使用main
方法。
我删除了我的主要和配置方法SpringBootServletInitializer的范围 ,并改为添加了此方法。 现在启动。
@Override
public void onStartup(ServletContext container) {
ApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/applicationContext.xml");
PollableChannel ftpChannel = context.getBean("ftpChannel", PollableChannel.class);
Message<?> message = ftpChannel.receive();
System.out.println("Received message: " + message);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.