2

I have created a docker image for the gateway application, but when i run the command: docker-compose up
only the microservice and the registry are UP but the gateway is not even appeared in the intances

22-08-25 10:57:23.661 ERROR 1 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed mygateway_1 | mygateway_1 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration' defined in file [/app/classes/ma/s2m/nxp/config/SecurityConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in file [/app/classes/ma/s2m/nxp/security/DomainUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in ma.s2m.nxp.repository.UserRepository defined in @EnableR2dbcRepositories declared on DatabaseConfiguration: Cannot create inner bean '(inner bean)#139c4f36' of type [org.springframework.data.repository.core.support.RepositoryFragmentsFactoryBean] while setting bean property 'repositoryFragments'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#139c4f36': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepositoryInternalImplFragment': Cannot resolve reference to bean 'userRepositoryInternalImpl' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userRepositoryInternalImpl' defined in file [/app/classes/ma/s2m/nxp/repository/UserRepositoryInternalImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'r2dbcDatabaseClient' defined in class path resource [org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryDependentConfiguration.class]: Unsatisfied dependency expressed through method 'r2dbcDatabaseClient' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/r2dbc/ConnectionFactoryConfigurations$PoolConfiguration$PooledConnectionFactoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.r2dbc.pool.ConnectionPool]: Factory method 'connectionFactory' threw exception; nested exception is java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={driver=postgresql, database=myGateway, host=mygateway-postgresql, port=5432, user=myGateway}}'. Available drivers: [ h2, pool ]

Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
Khadija
  • 55
  • 5
  • 1
    Well the error seems to say that your app cannot connect to your postgresql db: "Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={driver=postgresql, database=myGateway, host=mygateway-postgresql, port=5432, user=myGateway}}'. Available drivers: [ h2, pool ]" – Gaël Marziou Aug 25 '22 at 15:58
  • so what should i do to overpass the error, normally everything is configured bu default by jhipster and docker compose isn't it? – Khadija Aug 26 '22 at 08:14
  • What is your developer level? – Gaël Marziou Aug 26 '22 at 08:56
  • I am a junior developer – Khadija Aug 26 '22 at 10:22
  • OK, so why do you want to use a microservices architecture? What are the benefits you expect versus the added complexity? I predict you will have hard time to master it, your productivity will drop and potentially you will fail unless you have a senior developer mentoring you. For example, you will have to learn Spring Cloud in addition to Spring Boot, how many weeks do you have for this extra learning? – Gaël Marziou Aug 26 '22 at 10:50
  • I am learning almost everyday new concepts and trying to understand more and more jhipster and its architecture. I don't know honestly, I am working on this project since 2 weeks and I am pursuing to do so! according to your experience how much would that need? and I'll learn more about Spring Cloud and Spring boot to master that more! what other blocs i need to know besides? – Khadija Aug 26 '22 at 11:03
  • 1
    The list of all technologies used in JHipster is available in https://www.jhipster.tech/, I would say that there are 10 of them on backend and 8 on frontend. While you are learning technologies that will change over time, you may not spend enough time learning on the most important skill that will help you for your whole career: business modeling, learn about Domain Driven Design, hexagonal architecture. If you are thinking of adding a list of techs on your CV, keep in mind that unless your project has been in production under heavy load, this knowledge is not as valuable as you may think. – Gaël Marziou Aug 26 '22 at 11:38
  • 1
    To master Spring Boot and Hibernate, I would say it takes few years. To get comfortable with them: 3 months. You will learn things more in depth if you start with a monolith – Gaël Marziou Aug 26 '22 at 11:42
  • alright thanks, i would take all you said into consideration – Khadija Aug 26 '22 at 15:52

0 Answers0