春季启动和Apache火花 - 集装箱冲突 [英] Spring boot and apache spark - container conflict

查看:142
本文介绍了春季启动和Apache火花 - 集装箱冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在项目中使用的弹簧引导1.1.5和Apache 1.0.2火花一起。看起来像Apache的火花内部使用集装箱码头我和春天配置开机使用Tomcat容器。但是应用程序启动失败,并在根源一些SecurityException异常。如果我看到完整的堆栈跟踪看起来像春天的启动尝试初始化jettyEmbeddedServletContainerFactory,这不应该排在首位。它可能把它捡起从classpath中,由于通过火花码头presence。如果我排除火花码头,并再次运行我不要再后来看到相同的错误SparkContext初始化由于找不到码头失败。我如何告诉春季启动运行时寻找TomcatEmbeddedServletContainerFactory,而不是码头吗?

I am trying to use spring boot 1.1.5 and apache spark 1.0.2 together in project. Look like apache spark uses Jetty container internally and I have configured spring-boot to use Tomcat container. However application startup fails with some securityException at root cause. If I see full stack trace looks like spring boot trying to initialize "jettyEmbeddedServletContainerFactory" which it shouldn't in first place. It probably picks it up from classpath due to jetty presence via spark. If I exclude jetty from spark and run again I don't see same error again but then SparkContext initialization fails due to not finding jetty. How do i tell spring-boot runtime to look for "TomcatEmbeddedServletContainerFactory" instead of jetty one?

推荐答案

@Joakim Erdfelt,谢谢。

我只是在等待,看看是否有人熟悉这种情况,如果它只是一个小的配置变化。事实证明它是!

@Configuration

@EnableAutoConfiguration(不含= {} EmbeddedServletContainerFactory.class)

公共类MyConfiguration {}

@Joakim Erdfelt, Thanks.
I was just waiting to see if someone is familiar with this situation and if it's just a small configuration change. As it turns out it is!

@Configuration
@EnableAutoConfiguration(exclude={EmbeddedServletContainerFactory.class})
public class MyConfiguration { }



我定义我自己的EmbeddedServletContainerFactory豆作为org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContaine rFactory,并开始工作,我的预期。


I defined my own "EmbeddedServletContainerFactory" bean as a "org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContaine‌​rFactory" and it started working as I expected.

这篇关于春季启动和Apache火花 - 集装箱冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆