cer / event-sourcing-examples

Example code for my building and deploying microservices with event sourcing, CQRS and Docker presentation
Other
3.12k stars 946 forks source link

docker-compose build fail #5

Closed clearraining closed 9 years ago

clearraining commented 9 years ago

when i use

./gradlew assemble

compile is successed.

:testutil:jar UP-TO-DATE
:testutil:assemble UP-TO-DATE
:transactions-command-side-backend:assemble UP-TO-DATE
:transactions-command-side-service:compileJava UP-TO-DATE
:transactions-command-side-service:processResources UP-TO-DATE
:transactions-command-side-service:classes UP-TO-DATE
:transactions-command-side-service:jar
:transactions-command-side-service:bootRepackage
:transactions-command-side-service:assemble
:transactions-command-side-web:assemble UP-TO-DATE

BUILD SUCCESSFUL

Total time: 38.508 secs

but when copy docker-compose.yml to file java-spring and use

docker-compose up

is fail .

accountscommandside_1     | Field error in object 'eventStore' on field 'stompServerPort': rejected value []; codes [typeMismatch.eventStore.stompServerPort,typeMismatch.stompServerPort,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [eventStore.stompServerPort,stompServerPort]; arguments []; default message [stompServerPort]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'stompServerPort'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type int]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventStore.CONFIGURATION_PROPERTIES': Could not bind properties to [unknown] (target=eventStore, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
accountscommandside_1     | Field error in object 'eventStore' on field 'stompServerPort': rejected value []; codes [typeMismatch.eventStore.stompServerPort,typeMismatch.stompServerPort,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [eventStore.stompServerPort,stompServerPort]; arguments []; default message [stompServerPort]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'stompServerPort'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type int]
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:464)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
accountscommandside_1     |     ... 46 more
accountscommandside_1     | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventStore.CONFIGURATION_PROPERTIES': Could not bind properties to [unknown] (target=eventStore, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
accountscommandside_1     | Field error in object 'eventStore' on field 'stompServerPort': rejected value []; codes [typeMismatch.eventStore.stompServerPort,typeMismatch.stompServerPort,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [eventStore.stompServerPort,stompServerPort]; arguments []; default message [stompServerPort]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'stompServerPort'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type int]
accountscommandside_1     |     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:303)
accountscommandside_1     |     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:250)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
accountscommandside_1     |     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
accountscommandside_1     |     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:813)
accountscommandside_1     |     at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
accountscommandside_1     |     ... 60 more
accountscommandside_1     | Caused by: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
accountscommandside_1     | Field error in object 'eventStore' on field 'stompServerPort': rejected value []; codes [typeMismatch.eventStore.stompServerPort,typeMismatch.stompServerPort,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [eventStore.stompServerPort,stompServerPort]; arguments []; default message [stompServerPort]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'stompServerPort'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type int]
accountscommandside_1     |     at org.springframework.boot.bind.PropertiesConfigurationFactory.validate(PropertiesConfigurationFactory.java:296)
accountscommandside_1     |     at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:255)
accountscommandside_1     |     at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:227)
accountscommandside_1     |     at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:296)
accountscommandside_1     |     ... 74 more
javaspring_accountscommandside_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
Stopping javaspring_accountsqueryside_1...
Stopping javaspring_mongodb_1...

thanks! someone help.

cer commented 9 years ago

What's the value of the OS environment variable EVENT_STORE_STOMP_SERVER_PORT If that is not a value that can be converted to an int then I wonder whether it could cause this error.

clearraining commented 9 years ago

In my os environment don't have the EVENT_STORE_STOMP_SERVER_PORT variable, and i set the value as 8087, another problem:

accountscommandside_1     |     at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
accountscommandside_1     |     ... 60 more
accountscommandside_1     | [DEBUG] [09/12/2015 02:13:10.946] [eventStore-akka.actor.default-dispatcher-4] [akka://eventStore/system/log1-Slf4jLogger] stopped
accountscommandside_1     | [DEBUG] [09/12/2015 02:13:10.947] [eventStore-akka.actor.default-dispatcher-5] [EventStream] all default loggers stopped
javaspring_transactionscommandside_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
Stopping javaspring_accountsqueryside_1...
Stopping javaspring_mongodb_1...

i don't know what the exact problem?

cer commented 9 years ago

If you look earlier in the log you will probably see

transactionscommandside_1 | Caused by: java.lang.NullPointerException
transactionscommandside_1 |     at net.chrisrichardson.eventstore.client.HttpEntityEventStore.<init>(HttpEntityEventS

That's because there are several environment variables that need to be set. As described here you need to get credentials for the event store server in order to run the dockerized version of the application.

Sorry about this.

I will work on improving both the documentation and error messages.

cer commented 8 years ago

Igor,

The docker-compose.yml passes environment variables from the host OS to the containers. If they are not set in the host then they are not set in the containers. As described here - http://eventuate.io/docs/java/spring-configuration.html

I hope this helps.

Chris

On Mon, Feb 15, 2016 at 4:49 AM, Igor Petrov notifications@github.com wrote:

Hey folks.

Can you please explain why does dockerized version of application fails if there is no OS variable explicitly set? I mean I have the same issue. My app loads some ports and flags from yaml and the host OS resolves everything while dockerized says that it can't find a converter.

Kind regards, Igor

— Reply to this email directly or view it on GitHub https://github.com/cer/event-sourcing-examples/issues/5#issuecomment-184192749 .

Microservices application platform http://eventuate.io

1petr0v commented 8 years ago

Good day, Chris.

Thank you very much for the response. Actually I found the same myself that's why I've deleted the message (and also a bug inside my app :) ). Thank you again :+1:

Regards, Igor

cer commented 8 years ago

Igor,

That would explain my your email wasn't in the github issue. :-) Glad the problem is resolved. Please don't hesitate to ping me if you have more questions.

Chris

On Mon, Feb 15, 2016 at 7:05 AM, Igor Petrov notifications@github.com wrote:

Good day, Chris.

Thank you very much for the response. Actually I found the same myself that's why I've deleted the message (and also a bug inside my app :) ). Thank you again [image: :+1:]

Regards, Igor

— Reply to this email directly or view it on GitHub https://github.com/cer/event-sourcing-examples/issues/5#issuecomment-184246375 .

Microservices application platform http://eventuate.io