generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

monolith can't config hazelcast.management-center?

Open zicjin opened this issue 3 years ago • 2 comments

Overview of the issue
***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target [Bindable@509e7d7d type = tech.jhipster.config.JHipsterProperties, value = 'provided', annotations = array<Annotation>[@org.springframework.boot.context.properties.ConfigurationProperties(ignoreInvalidFields=false, ignoreUnknownFields=false, prefix="jhipster", value="jhipster")]] failed:

   Property: jhipster.cache.hazelcast.management-center.enabled
   Value: false
   Origin: class path resource [config/application-dev.yml] - 101:18
   Reason: The elements [jhipster.cache.hazelcast.management-center.enabled,jhipster.cache.hazelcast.management-center.update-interval,jhipster.cache.hazelcast.management-center.url] were left unbound.
   Property: jhipster.cache.hazelcast.management-center.update-interval
   Value: 3
   Origin: class path resource [config/application-dev.yml] - 102:26
   Reason: The elements [jhipster.cache.hazelcast.management-center.enabled,jhipster.cache.hazelcast.management-center.update-interval,jhipster.cache.hazelcast.management-center.url] were left unbound.
   Property: jhipster.cache.hazelcast.management-center.url
   Value: http://localhost:8180/mancenter
   Origin: class path resource [config/application-dev.yml] - 103:14
   Reason: The elements [jhipster.cache.hazelcast.management-center.enabled,jhipster.cache.hazelcast.management-center.update-interval,jhipster.cache.hazelcast.management-center.url] were left unbound.

Action:

Update your application's configuration
Reproduce the error

my application-dev.yml:

jhipster:
  cache: # Cache configuration
    hazelcast: # Hazelcast distributed cache
      time-to-live-seconds: 3600
      backup-count: 1
      management-center:
        enabled: true
        update-interval: 3
        url: http://localhost:8180/mancenter
Related issues

Add support for the JHipster Registry in monolith applications

JHipster Version(s)

7.8.1

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "jwt",
    "baseName": "jhipster",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "hazelcast",
    "clientFramework": "no",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1655560711522,
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.8.1",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "languages": ["en", "fr"],
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.mycompany.myapp",
    "pages": [],
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": "8080",
    "serverSideOptions": [],
    "serviceDiscoveryType": "eureka",
    "skipCheckLengthOfIdentifier": false,
    "skipClient": true,
    "skipFakeData": false,
    "skipUserManagement": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": true
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

java version "17.0.1" 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

git version 2.27.0.windows.1

node: v16.14.2

npm: 8.5.3

Docker version 20.10.16, build aa7e414

Docker Compose version v2.6.0

Browsers and Operating System

windows 11 21H2

zicjin avatar Jun 19 '22 03:06 zicjin

I have encounter this issue today. I configured it in my microservice project. 'docker-jhipster-registry' and 'docker-product-hazelcast-management-center' both have been started normally.

jhipster:
  cache: # Cache configuration
    hazelcast: # Hazelcast distributed cache
      time-to-live-seconds: 3600
      backup-count: 1
      management-center:
        enabled: true 
        update-interval: 3
        url: http://localhost:8180/mancenter

I used JHipster 7.8.1 and not found corresponding properties in Java class: JHipsterProperties

public static class Hazelcast {
            private int timeToLiveSeconds = JHipsterDefaults.Cache.Hazelcast.timeToLiveSeconds;
            private int backupCount = JHipsterDefaults.Cache.Hazelcast.backupCount;

            public int getTimeToLiveSeconds() {
                return timeToLiveSeconds;
            }

            public void setTimeToLiveSeconds(int timeToLiveSeconds) {
                this.timeToLiveSeconds = timeToLiveSeconds;
            }

            public int getBackupCount() {
                return backupCount;
            }

            public void setBackupCount(int backupCount) {
                this.backupCount = backupCount;
            }
        }

How to solve this issue, please!

SharpQin avatar Jun 24 '22 14:06 SharpQin

I found following code in the old version. But how to use Hazelcast as a distributed cache in latest version? io/github/jhipster/config/JHipsterProperties.java

public static class Hazelcast {

    private int timeToLiveSeconds = JHipsterDefaults.Cache.Hazelcast.timeToLiveSeconds;

    private int backupCount = JHipsterDefaults.Cache.Hazelcast.backupCount;

    private final ManagementCenter managementCenter = new ManagementCenter();

    /**
     * In the Hazelcast v4.x, the cluster node doesn't expose
     * configurations to connect to the management center. Setting up
     * of this property doesn't provide any behavior and has been
     * retained for the backward compatibility, and should be
     * removed in the next major release of the JHipster
     *
     * @return a {@link io.github.jhipster.config.JHipsterProperties.Cache.Hazelcast.ManagementCenter} object.
     */
    @Deprecated
    public ManagementCenter getManagementCenter() {
        return managementCenter;
    }

    /**
     * In the Hazelcast v4.x, the cluster node doesn't expose
     * configurations to connect to the management center. Setting up
     * of this class properties don't provide any behavior and has
     * been retained for the backward compatibility, and should be
     * removed in the next major release of the JHipster
     */
    @Deprecated
    public static class ManagementCenter {

        private boolean enabled = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.enabled;

        private int updateInterval = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.updateInterval;

        private String url = JHipsterDefaults.Cache.Hazelcast.ManagementCenter.url;

        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }

        public int getUpdateInterval() {
            return updateInterval;
        }

        public void setUpdateInterval(int updateInterval) {
            this.updateInterval = updateInterval;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

    }

    public int getTimeToLiveSeconds() {
        return timeToLiveSeconds;
    }

    public void setTimeToLiveSeconds(int timeToLiveSeconds) {
        this.timeToLiveSeconds = timeToLiveSeconds;
    }

    public int getBackupCount() {
        return backupCount;
    }

    public void setBackupCount(int backupCount) {
        this.backupCount = backupCount;
    }
}

SharpQin avatar Jun 24 '22 15:06 SharpQin

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days

github-actions[bot] avatar Dec 12 '23 00:12 github-actions[bot]