0

I have see that there is possibility to use JHipster with node.js "generator-jhipster-nodejs" from the original JHipster branch. https://github.com/jhipster/generator-jhipster-nodejs

I'm trying to use it, but in particularly I have problem with one part.

I have installed a gateway to use as front end. I have installed a microservice to use as back end.

And then I have downloaded from the JHipster repository the registry.

So I have:

  1. Gateway
  2. Microservice for Back end
  3. Registry

Now If I start Gateway e Back end they communicate each other ( so for example if I make a get on front end I can read log about backed that makes the get call )

But the problem is the Registry.

I'm starting the registry using mvnw command, and then start the front end and back end. So when I go to localhost:8761 I should find all the application instances registered, but they aren't. I can see only the registry but not the gateway and microservice.

So my question is, how can I do to allows gateway and registry to communicate (and also microservice and registry) ?

I have checked the application-dev.yml file but it seems to be configurated to comunicate with the registry.

EDIT:

application-dev.yml

# ===================================================================
# Configuration for the "dev" profile.
#
# This configuration overrides the application.yml file.
#
# More information on profiles: https://www.jhipster.tech/profiles/
# More information on configuration properties: https://www.jhipster.tech/common-application-properties/
# ===================================================================

# ===================================================================
# Standard app properties.
# ===================================================================

eureka:
    instance:
        prefer-ip-address: true
    client:
        service-url:
            defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/

server:
    port: 8081

    mail:
        host: localhost
        port: 25
        username:
        password:

spring:
    devtools:
        restart:
            enabled: true
            additional-exclude: static/**
        livereload:
            enabled: false # we use Webpack dev server + BrowserSync for livereload
    jackson:
        serialization:
            indent-output: true
    cloud:
        config:
            uri: http://admin:${jhipster.registry.password}@localhost:8761/config
            # name of the config server's property source (file.yml) that we want to use
            name: NhipsterGateway
            profile: dev
            label: main # toggle to switch to a different version of the configuration as stored in git
            # it can be set to any label, branch or commit of the configuration source Git repository

# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================

jhipster:
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: NhipsterGateway@localhost
        base-url: http://127.0.0.1:8082
    gateway:
        rate-limiting: 
            enabled: false
            limit: 100000
            duration-in-seconds: 3600
    registry:
        password: admin
    cors:
        allowed-origins: 'http://localhost:8100,http://localhost:9000'
        allowed-methods: '*'
        allowed-headers: '*'
        exposed-headers: 'Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params'
        allow-credentials: true
        max-age: 1800
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# https://www.jhipster.tech/common-application-properties/
# ===================================================================

# application:

EDIT 2: (Logs about registry)

2022-02-22 11:01:52.721  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_JHIPSTER-REGISTRY/jhipsterRegistry:f94fa23db14e2a7bf396779dbcb6c37b - was unable to refresh its cache! This periodic background refresh will be retried in 10 seconds. status = Cannot execute request on any known server stacktrace = com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
        at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
        at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
        at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
        at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1101)
        at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:1014)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:441)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:283)
        at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279)
        at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:66)
        at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:295)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:374)
        at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:376)
        at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:179)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:371)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:195)
        at com.sun.proxy.$Proxy136.getApplications(Unknown Source)
        at org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration.peerAwareInstanceRegistry(EurekaServerAutoConfiguration.java:148)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at tech.jhipster.registry.JHipsterRegistryApp.main(JHipsterRegistryApp.java:73)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

2022-02-22 11:01:52.748  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Initial registry fetch from primary servers failed
2022-02-22 11:01:52.749  WARN 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Using default backup registry implementation which does not do anything.
2022-02-22 11:01:52.750  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Initial registry fetch from backup servers failed
2022-02-22 11:01:52.752  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 5
2022-02-22 11:01:52.754  INFO 18864 --- [  restartedMain] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 12
2022-02-22 11:01:52.762  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1645524112756 with initial instances count: 0
2022-02-22 11:01:52.785  INFO 18864 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1645524112785, current=DOWN, previous=STARTING]
2022-02-22 11:01:52.789  INFO 18864 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_JHIPSTER-REGISTRY/jhipsterRegistry:f94fa23db14e2a7bf396779dbcb6c37b: registering service...
2022-02-22 11:01:52.813  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2022-02-22 11:01:52.814  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2022-02-22 11:01:52.814  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2022-02-22 11:01:52.814  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2022-02-22 11:01:52.985  INFO 18864 --- [  restartedMain] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1645524112985, current=UP, previous=DOWN]
2022-02-22 11:01:52.986  WARN 18864 --- [  restartedMain] c.n.discovery.InstanceInfoReplicator     : Ignoring onDemand update due to rate limiter
2022-02-22 11:01:52.987  WARN 18864 --- [  restartedMain] c.n.discovery.InstanceInfoReplicator     : Ignoring onDemand update due to rate limiter
2022-02-22 11:01:53.063  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2022-02-22 11:01:53.063  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2022-02-22 11:01:53.063  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2022-02-22 11:01:53.063  INFO 18864 --- [  restartedMain] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2022-02-22 11:01:53.330  INFO 18864 --- [  restartedMain] org.jboss.threads                        : JBoss Threads version 3.1.0.Final
2022-02-22 11:01:53.893  INFO 18864 --- [  restartedMain] t.jhipster.registry.JHipsterRegistryApp  : Started JHipsterRegistryApp in 21.527 seconds (JVM running for 22.202)
2022-02-22 11:01:53.898  INFO 18864 --- [  restartedMain] t.jhipster.registry.JHipsterRegistryApp  :
----------------------------------------------------------
        Application 'jhipster-registry' is running! Access URLs:
        Local:          http://localhost:8761/
        External:       http://172.27.32.1:8761/
        Profile(s):     [composite, dev, api-docs]
----------------------------------------------------------
2022-02-22 11:01:53.905  INFO 18864 --- [  restartedMain] t.jhipster.registry.JHipsterRegistryApp  :
----------------------------------------------------------
        Config Server:  Connected to the JHipster Registry config server!
Jack23
  • 1,368
  • 7
  • 32
  • You said that the application-dev.yml of your gateway is configured as an Eureka client of the registry so it should log connection attempts when you start it. – Gaël Marziou Feb 21 '22 at 16:39
  • Thank you for your answer, I edited my post with the applicavtion-dev.yml – Jack23 Feb 22 '22 at 09:23
  • What did you see in logs? – Gaël Marziou Feb 22 '22 at 09:58
  • I edited the question one more time about the registry's logs – Jack23 Feb 22 '22 at 10:04
  • I notice this: ```2022-02-22 11:01:43.344 INFO 18864 --- [ restartedMain] t.jhipster.registry.JHipsterRegistryApp : The following profiles are active: composite,dev,api-docs 2022-02-22 11:01:45.744 INFO 18864 --- [ restartedMain] t.j.registry.config.WebConfigurer : Web application configuration, using profiles: composite.``` Can be the probelm the composite profile? – Jack23 Feb 22 '22 at 10:13
  • 1
    The logs of the application connecting to the registry are more important than the logs of the registry startup you pasted. No problem with the composite profile, see https://www.jhipster.tech/jhipster-registry/#spring-profiles – Gaël Marziou Feb 22 '22 at 10:30
  • So you refer about the logs of Gateway for example?? It doesn't print nothing about registry. It's only prints the access URL. I don't know if the problem could be the fact that the gateway is in nodejs – Jack23 Feb 22 '22 at 10:34

0 Answers0