Debugging I see that on startup bean EmbeddedServletContainerFactory exists (jetty) and works
but on refresh , via HTTP, post the included snippet from EmbeddedWebApplicationContext cannot find de the factory
See attached sources. Can somebody help me?
I' am willing to refresh to reload propertysourcess .regafrs
protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory() {
// Use bean names so that we don't consider the hierarchy
String[] beanNames = getBeanFactory()
.getBeanNamesForType(EmbeddedServletContainerFactory.class);
if (beanNames.length == 0) {
throw new ApplicationContextException(
"Unable to start EmbeddedWebApplicationContext due to missing "
+ "EmbeddedServletContainerFactory bean.");
}
if (beanNames.length > 1) {
throw new ApplicationContextException(
"Unable to start EmbeddedWebApplicationContext due to multiple "
+ "EmbeddedServletContainerFactory beans : "
+ StringUtils.arrayToCommaDelimitedString(beanNames));
}
return getBeanFactory().getBean(beanNames[0],
EmbeddedServletContainerFactory.class);
}
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:138) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:62) [spring-cloud-context-1.1.SE.jar:1.1.7.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) [spring-context-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:72) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:338) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:309) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.cloud.context.refresh.ContextRefresher.addConfigFilesToEnvironment(ContextRefresher.java:74) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.context.refresh.ContextRefresher.refresh(ContextRefresher.java:54) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.endpoint.RefreshEndpoint.refresh(RefreshEndpoint.java:46) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.endpoint.RefreshEndpoint.invoke(RefreshEndpoint.java:52) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at org.springframework.cloud.endpoint.RefreshEndpoint.invoke(RefreshEndpoint.java:33) [spring-cloud-context-1.1.7.RELEASE1.7.RELEASE]
at org.springframework.boot.actuate.endpoint.mvc.AbstractEndpointMvcAdapter.invoke(AbstractEndpointMvcAdapter.java:56) [spring-boot-actuator-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke(EndpointMvcAdapter.java:44) [spring-boot-actuator-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke(GenericPostableMvcEndpoint.java:49) [spring-cloud-context-1.1.7.RELEASE.jar:1.1.7.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) [spring-webmvc-4.3.6.RELEASE.j6.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:205) [websocket-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) [spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105) [spring-boot-actuator-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFiltPerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.springframework.boot.actuate.autoconfigure.MetricsFilteterInternal(MetricsFilter.java:106) [spring-boot-actuator-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [jetty-security-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [jetty-servlet-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.Server.handle(Server.java:534) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConneava:251) [jetty-server-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [jetty-io-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) [jetty-io-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [jetty-io-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [jetty-util-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [jetty-util-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [jetty-util-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [jetty-util-9.3.16.v20170120.jar:9.3.16.v20170120]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [jetty-util-9.3.16.v20170120.jar:9.3.16.v20170120]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:189) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:162) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.4.RELEASE.jar:1.4.4.RELEASE]
... 89 common frames omitted
md5-6435f25dcb5ad221300226a079b8c4cb
security:
basic:
enabled: false
info:
component: Config Server
management:
context_path: /admin
endpoints:
refresh:
enabled: true
main:
web-environment: true
rabbitmq:
host: rabbitmq
port: 5672
username: guest
password: guest
listener:
max-concurrency: 500
concurrency: 50
default-requeue-rejected: false
acknowledge-mode: auto
md5-3b5dc41d8b3e07e1bd9e335d6b838e60
spring:
application:
name: configserver
cloud:
config:
uri: http://localhost:8888
md5-afb8fe9fb68114255e011fe7d9e556a7
package es.osoco.ulyseo.pricing
import es.osoco.ulyseo.pricing.application.packagegenerated.ApplyPriceToGeneratedPackageUseCase
import es.osoco.ulyseo.pricing.port.adapter.packagegenerated.PackageGeneratedAdapter
import es.osoco.ulyseo.pricing.port.adapter.packagegenerated.PackageGeneratedPort
import es.osoco.ulyseo.pricing.port.adapter.packagepricing.PackagePricingAdapter
import es.osoco.ulyseo.pricing.port.adapter.packagepricing.PackagePricingPort
import groovy.util.logging.Slf4j
import org.dozer.DozerBeanMapper
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory
import org.springframework.amqp.rabbit.connection.ConnectionFactory
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.autoconfigure.amqp.RabbitProperties
import org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration
import org.springframework.context.annotation.Bean
@Slf4j
@SpringBootApplication(exclude = [ContextStackAutoConfiguration])
class PricingApp {
@Autowired
private RabbitProperties props
@Autowired
private ConnectionFactory cachingConnectionFactory
// Setting the annotation listeners to use the jackson2JsonMessageConverter
@Bean
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory()
factory.setConnectionFactory(cachingConnectionFactory)
factory.setMessageConverter(jackson2JsonMessageConverter())
//Set properties from file
props.listener.with {
factory.setMaxConcurrentConsumers(maxConcurrency)
factory.setConcurrentConsumers(concurrency)
factory.setAcknowledgeMode(acknowledgeMode)
factory.setDefaultRequeueRejected(defaultRequeueRejected)
}
return factory
}
// Standardize on a single objectMapper for all message queue items
@Bean
Jackson2JsonMessageConverter jackson2JsonMessageConverter() {
return new Jackson2JsonMessageConverter()
}
@Bean
ApplyPriceToGeneratedPackageUseCase applyPriceToPackageGeneratedUseCase() {
new ApplyPriceToGeneratedPackageUseCase()
}
@Bean
PackageGeneratedPort packageGeneratedPort() {
new PackageGeneratedAdapter()
}
@Bean
PackagePricingPort packagePricingPort() {
new PackagePricingAdapter()
}
static void main(String[] args) throws Exception {
SpringApplication.run(PricingApp, args)
}
@Bean(name = 'org.dozer.Mapper')
DozerBeanMapper dozerBeanMapper() {
List<String> mappingFiles = ['dozer-application-mappings.xml']
DozerBeanMapper dozerBean = new DozerBeanMapper()
dozerBean.setMappingFiles(mappingFiles)
return dozerBean
}
}
md5-af61a73b2e25444854915dce2acfd1f0
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.4.4.RELEASE"
classpath 'ru.vyarus:gradle-quality-plugin:2.0.0'
classpath "io.spring.gradle:dependency-management-plugin:0.5.3.RELEASE"
}
}
apply plugin: 'groovy'
apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: "idea"
apply plugin: 'ru.vyarus.quality'
apply plugin: "io.spring.dependency-management"
apply plugin: 'propdeps'
apply from: 'docker.gradle'
apply from: 'quality.gradle'
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Camden.SR5'
}
}
jar {
baseName = 'ulyseo-pricing'
version = '0.0.1-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
compile.exclude module: "spring-boot-starter-tomcat"
}
idea.module {
sourceDirs += jsonschema2pojoOutputForIdea
}
sourceSets {
jsonschema2pojo {
java {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
srcDir jsonschema2pojoOutputForIdea
output.classesDir = file("${buildDir}/classes/main")
}
}
integrationTest {
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/groovy')
}
resources.srcDir file('src/integration-test/resources')
}
}
void retainAllSystemProperties(Test test) {
System.properties.each { k, v ->
test.systemProperty k, v
}
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
systemProperty 'spring.profiles.active', 'integration'
retainAllSystemProperties(delegate)
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
dependencies {
compile "org.codehaus.groovy:groovy-all:2.4.0"
compile "org.springframework.boot:spring-boot-starter"
compile "org.springframework.boot:spring-boot-starter-amqp"
compile "org.springframework.boot:spring-boot-starter-web"
compile 'org.springframework.cloud:spring-cloud-starter-config'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.cloud:spring-cloud-starter-aws'
compile 'org.springframework.boot:spring-boot-starter-jetty'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.91'
compile group: 'com.amazonaws', name: 'aws-java-sdk-core', version: '1.11.91'
///// <Required for jsonschema2pojo plugin>
compile 'commons-lang:commons-lang:2.6'
// Required if generating JSR-303 annotations
compile 'javax.validation:validation-api:1.1.0.CR2'
// Required if generating JodaTime data types
compile 'joda-time:joda-time:2.2'
compile 'org.hibernate:hibernate-validator:5.2.4.Final'
compile 'net.sf.dozer:dozer:5.5.1'
compile group: 'cglib', name: 'cglib-nodep', version: '2.2'
//Easy Rules
compile group: 'org.easyrules', name: 'easyrules-core', version: '2.3.0'
compile group: 'org.easyrules', name: 'easyrules-spring', version: '2.3.0'
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile 'org.spockframework:spock-spring:1.0-groovy-2.4'
}
repositories {
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
Same error with /restart endpoint
@Ferparishuertas if you'd like me to look at it please provide a project I can download, not copied into issues.
@spencergibb Can i send you a zipped version? i cannot make it pubic
Sure, email in profile.
@spencergibb sent :)
Hi @spencergibb . Have you any clue about the issue?
We faced the same issue. Comment the web-environment property (let the framework decide) is a possible workaround.
Regards,
@Ferparishuertas your project doesn't match above. I couldn't start it. I had to comment out all the wildfly javaee stuff.
@spencergibb wildfly? we dont use wildfly at all. Are you sure you didnt mix my project with other ones? I ve just reviewed what i sent you and its ok, no wildfly dependency. Itsusing jetty
Please resend the project
@RaphC what do you mean exactly with "Comment the web-environment property"? Do you mean not including spring.main.web-environment= true ?
@spencergibb Done!
@RaphC suprisingly works! Let me test it with some extra config
If that's the issue, I think we can close this.
@Ferparishuertas we're looking for tje root cause.Apparently there's a conflict betweem ApplicationContext(s)
One of ApplicationContext in cloud dependency force the web to false.... still working on it.I let you know when we identify the issue.
@RaphC thank you so much.
@RaphC Are there any news on that?
Tried to use config server (V 1.2.2, Camden.SR5) from jar-packaged spring boot app.
Config is fetched successfully however later context init. fails with the error message mentioned above.
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
We don't have the property spring.main.web-environment set.
So currently we cannot use spring cloud config :(
Hy @syr
Don't have time to investigate on it :(
Hi,
Something new? I've had the same error. It happens with the property spring.main.web-environment. When I added the property to the git repository, the server started to fail.
Regards.
Closing this due to inactivity. Please re-open if there's more to discuss.
getting same issue, I donot have web-environment in my configuration. any leads?
@ShirazMalkani
Can you provide a complete, minimal, verifiable sample that reproduces the problem?
@spencergibb @dsyer
I found that issue indeed related to main.web-environment: true property.
Code from NativeEnvironmentRepository.java:
SpringApplicationBuilder builder = new SpringApplicationBuilder(
PropertyPlaceholderAutoConfiguration.class);
ConfigurableEnvironment environment = getEnvironment(profile);
builder.environment(environment);
builder.web(false).bannerMode(Mode.OFF);
if (!logger.isDebugEnabled()) {
// Make the mini-application startup less verbose
builder.logStartupInfo(false);
}
String[] args = getArgs(config, profile, label);
// Explicitly set the listeners (to exclude logging listener which would change
// log levels in the caller)
builder.application()
.setListeners(Arrays.asList(new ConfigFileApplicationListener()));
ConfigurableApplicationContext context = builder.run(args);
Although we have builder.web(false) here but during context creation boot app gets not only from files but also regular classpath files from config server app.
And if there would be main.web-environment: true which is okay for config server it will set web parameter to true also to temp app...
IMHO the flow with temp app to retrieve Environment should not mess up with config server properties, so this ticket should be re-opened.
So far I don't see any simple solution for this, so just reporting w\o solution proposition :(
Most helpful comment
We faced the same issue. Comment the web-environment property (let the framework decide) is a possible workaround.
Regards,