Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nothing happens when running native-executable #151

Open
bakoorjakkals opened this issue Jun 27, 2024 · 0 comments
Open

Nothing happens when running native-executable #151

bakoorjakkals opened this issue Jun 27, 2024 · 0 comments

Comments

@bakoorjakkals
Copy link

I have generated a gateway application using jhipster-native. The gateway seems to build correctly, but when I run the application using npm run native-start or ./target/native-executable nothing is printed out to the terminal and the executable stops.

jaco:~/IdeaProjects/experiment/gateway$ ./target/native-executable 
jaco:~/IdeaProjects/experiment/gateway$ 

Here is my current environment setup:
OS: Ubuntu 24.04

$ sdk current java
Using java version 21-graalce
$ jhipster-native --version
INFO! No custom commands found within blueprint: generator-jhipster-native at /home/jaco/.nvm/versions/node/v20.12.2/lib/node_modules/generator-jhipster-native
2.2.0 (generator-jhipster 8.5.0)
$ jhipster --version
INFO! No custom commands found within blueprint: generator-jhipster-native at /home/jaco/IdeaProjects/experiment/gateway/node_modules/generator-jhipster-native
8.5.0
$ node -v
v20.12.2
$ npm -v
10.5.0

Here is the redacted output from generating the gateway app:

jhipster-native 
INFO! No custom commands found within blueprint: generator-jhipster-native at /home/jaco/.nvm/versions/node/v20.12.2/lib/node_modules/generator-jhipster-native

        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝
                            https://www.jhipster.tech
Welcome to JHipster v8.5.0

===================== JHipster Native =====================

 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/

  Application files will be generated in folder: /home/jaco/IdeaProjects/experiment/gateway
 _______________________________________________________________________________________________________________

WARNING!  ______________________________________________________________________________

  JHipster update available: 8.6.0 (current: 8.5.0)

  Run npm install -g generator-jhipster to update.

 ______________________________________________________________________________

? What is the base name of your application? gateway
? Which *type* of application would you like to create? Gateway application
? What is your default Java package name? com.example.gateway
? Would you like to use Maven or Gradle for building the backend? Maven
? As you are running in a microservice architecture, on which port would like your server to run? It should be unique to avoid port conflicts. 8080
? Which service discovery server do you want to use? Consul (recommended)
? Which *type* of authentication would you like to use? OAuth 2.0 / OIDC Authentication (stateful, works with Keycloak and Okta)
? Do you want to allow relationships with User entity? Yes
? Besides JUnit, which testing frameworks would you like to use? 
? Which *type* of database would you like to use? SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL)
? Which *production* database would you like to use? PostgreSQL
? Which *development* database would you like to use? PostgreSQL
? Which cache do you want to use? (Spring cache abstraction) Hazelcast (distributed cache, for multiple nodes, supports rate-limiting for gateway applications)
? Do you want to use Hibernate 2nd level cache? Yes
? Which other technologies would you like to use? 
? Which *framework* would you like to use for the client? Angular
? Do you want to enable *microfrontends*? No
? Besides Jest/Vitest, which testing frameworks would you like to use? 
? Do you want to generate the admin UI? Yes
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
WARNING! Could not fetch bootswatch themes from API. Using default ones.
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install 

[ Files being created ... ]

Changes to package.json were detected.
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.example.gateway:gateway >---------------------
[INFO] Building Gateway 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- frontend:1.15.0:install-node-and-npm (install-node-and-npm) @ gateway ---
[INFO] Installing node version v20.14.0
[INFO] Downloading https://nodejs.org/dist/v20.14.0/node-v20.14.0-linux-x64.tar.gz to /home/jaco/.m2/repository/com/github/eirslett/node/20.14.0/node-20.14.0-linux-x64.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /home/jaco/.m2/repository/com/github/eirslett/node/20.14.0/node-20.14.0-linux-x64.tar.gz into /home/jaco/IdeaProjects/experiment/gateway/target/node/tmp
[INFO] Copying node binary from /home/jaco/IdeaProjects/experiment/gateway/target/node/tmp/node-v20.14.0-linux-x64/bin/node to /home/jaco/IdeaProjects/experiment/gateway/target/node/node
[INFO] Installed node locally.
[INFO] Installing npm version 10.8.1
[INFO] Downloading https://registry.npmjs.org/npm/-/npm-10.8.1.tgz to /home/jaco/.m2/repository/com/github/eirslett/npm/10.8.1/npm-10.8.1.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /home/jaco/.m2/repository/com/github/eirslett/npm/10.8.1/npm-10.8.1.tar.gz into /home/jaco/IdeaProjects/experiment/gateway/target/node/node_modules
[INFO] Installed npm locally.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:32 min
[INFO] Finished at: 2024-06-27T17:19:03+02:00
[INFO] ------------------------------------------------------------------------
Using node installed locally v20.14.0
Using npm installed locally 10.8.1
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated read-package-json@7.0.1: This package is no longer supported. Please use @npmcli/package-json instead.
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.1: Glob versions prior to v9 are no longer supported
npm warn deprecated domexception@4.0.0: Use your platform's native DOMException instead

> gateway@0.0.1-SNAPSHOT prepare
> husky


added 1888 packages in 17m

311 packages are looking for funding
  run `npm fund` for details
✔ Application successfully committed to Git from /home/jaco/IdeaProjects/experiment/gateway.
✔ Spring Boot application generated successfully.
  Run your Spring Boot application:
  ./mvnw
WARNING! JHipster Native is only tested with PostgreSQL database
     info You can see some tips about running Spring Boot with GraalVM at https://github.com/mraible/spring-native-examples#readme.
✔ Angular application generated successfully.
  Start your Webpack development server with:
  npm start


Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Thanks for using JHipster!

I then ran npm run native-package. Here is some of the output I received:

$ npm run native-package

> gateway@0.0.1-SNAPSHOT native-package
> ./mvnw package -B -ntp -Pnative,prod -DskipTests

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.example.gateway:gateway >---------------------
[INFO] Building Gateway 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- enforcer:3.5.0:enforce (enforce-versions) @ gateway ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO] 
[INFO] --- enforcer:3.5.0:enforce (enforce-dependencyConvergence) @ gateway ---
[WARNING] Rule 0: org.apache.maven.enforcer.rules.dependency.DependencyConvergence failed with message:
Failed while enforcing releasability.

Dependency convergence error for org.checkerframework:checker-qual:jar:3.37.0 paths to dependency are:
+-com.example.gateway:gateway:jar:0.0.1-SNAPSHOT
  +-com.github.ben-manes.caffeine:caffeine:jar:3.1.8:compile
    +-org.checkerframework:checker-qual:jar:3.37.0:compile
and
+-com.example.gateway:gateway:jar:0.0.1-SNAPSHOT
  +-org.postgresql:postgresql:jar:42.7.3:compile
    +-org.checkerframework:checker-qual:jar:3.42.0:runtime


Dependency convergence error for org.apache.httpcomponents:httpclient:jar:4.5.5 paths to dependency are:
+-com.example.gateway:gateway:jar:0.0.1-SNAPSHOT
  +-org.springframework.cloud:spring-cloud-starter-consul-config:jar:4.1.1:compile
    +-org.springframework.cloud:spring-cloud-starter-consul:jar:4.1.1:compile
      +-com.ecwid.consul:consul-api:jar:1.4.5:compile
        +-org.apache.httpcomponents:httpclient:jar:4.5.5:runtime
and
+-com.example.gateway:gateway:jar:0.0.1-SNAPSHOT
  +-org.springframework.cloud:spring-cloud-starter-consul-config:jar:4.1.1:compile
    +-org.springframework.cloud:spring-cloud-starter-consul:jar:4.1.1:compile
      +-org.apache.httpcomponents:httpclient:jar:4.5.14:compile

Lots of [INFO] logs ... 

[WARNING] unknown enum constant javax.annotation.meta.When.MAYBE
  reason: class file for javax.annotation.meta.When not found
[WARNING] unknown enum constant javax.annotation.meta.When.MAYBE
  reason: class file for javax.annotation.meta.When not found
[WARNING] unknown enum constant javax.annotation.meta.When.MAYBE
  reason: class file for javax.annotation.meta.When not found
[WARNING] /home/jaco/IdeaProjects/experiment/gateway/src/main/java/com/example/gateway/repository/EntityManager.java:[208,41] getMappedObject(org.springframework.data.domain.Sort,org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>) in org.springframework.data.r2dbc.query.QueryMapper has been deprecated and marked for removal

...

[WARNING]  Parameter 'systemProperties' is deprecated: Use systemPropertyVariables instead.
...
[WARNING] 'native:build' goal is deprecated. Use 'native:compile-no-fork' instead.
...
[WARNING] Properties file at 'jar:file:///home/jaco/.m2/repository/org/eclipse/angus/jakarta.mail/2.0.3/jakarta.mail-2.0.3.jar!/META-INF/native-image/org.eclipse.angus/angus-core/native-image.properties' does not match the recommended 'META-INF/native-image/org.eclipse.angus/jakarta.mail/native-image.properties' layout.
...
Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.

...

========================================================================================================================
GraalVM Native Image: Generating 'native-executable' (executable)...
========================================================================================================================
[1/8] Initializing...                                                                                   (13.3s @ 0.27GB)
 Java version: 21+35, vendor version: GraalVM CE 21+35.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: gcc (linux, x86_64, 13.2.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 4 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
 - org.eclipse.angus.mail.nativeimage.AngusMailFeature
 - org.springframework.aot.nativex.feature.PreComputeFieldFeature
------------------------------------------------------------------------------------------------------------------------
 2 experimental option(s) unlocked:
 - '-H:ResourceConfigurationResources' (origin(s): 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties' in 'file:///home/jaco/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.24/tomcat-embed-el-10.1.24.jar')
 - '-H:ReflectionConfigurationResources' (origin(s): 'META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/native-image.properties' in 'file:///home/jaco/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/10.1.24/tomcat-embed-el-10.1.24.jar')
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 8.89GB of memory (45.8% of 19.40GB system memory, set via '-Xmx10g')
 - 8 thread(s) (100.0% of 8 available processor(s), determined at start)
Warning: Could not register complete reflection metadata for org.springframework.security.config.annotation.web.configuration.WebMvcSecurityConfiguration$HandlerMappingIntrospectorCacheFilterFactoryBean. Reason(s): java.lang.NoClassDefFoundError: org/springframework/web/servlet/config/annotation/WebMvcConfigurer.
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
[2/8] Performing analysis...  [*****]                                                                  (126.6s @ 1.82GB)
   22,136 reachable types   (88.1% of   25,136 total)
   33,391 reachable fields  (61.5% of   54,313 total)
  105,748 reachable methods (60.2% of  175,774 total)
    8,039 types, 3,594 fields, and 18,376 methods registered for reflection
       65 types,    65 fields, and    57 methods registered for JNI access
        4 native libraries: dl, pthread, rt, z
[3/8] Building universe...                                                                              (11.0s @ 2.72GB)
[4/8] Parsing methods...      [***]                                                                      (7.1s @ 3.59GB)
[5/8] Inlining methods...     [****]                                                                     (4.2s @ 3.23GB)
[6/8] Compiling methods...    [********]                                                                (72.7s @ 2.22GB)
[7/8] Layouting methods...    [***]                                                                     (10.4s @ 2.54GB)
[8/8] Creating image...       [***]                                                                      (9.6s @ 3.45GB)
  48.93MB (46.36%) for code area:    71,081 compilation units
  50.65MB (47.99%) for image heap:  480,017 objects and 394 resources
   5.96MB ( 5.65%) for other data
 105.55MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area:                                Top 10 object types in image heap:
  15.07MB java.base                                           14.73MB byte[] for code metadata
   3.97MB java.xml                                             6.96MB byte[] for java.lang.String
   2.97MB liquibase-core-4.27.0.jar                            5.88MB java.lang.Class
   2.10MB svm.jar (Native Image)                               4.47MB java.lang.String
   2.09MB caffeine-3.1.8.jar                                   3.95MB byte[] for embedded resources
   2.05MB jackson-databind-2.17.1.jar                          2.08MB byte[] for reflection metadata
   1.47MB aspectjweaver-1.9.22.jar                             1.86MB com.oracle.svm.core.hub.DynamicHubCompanion
   1.44MB spring-core-6.1.8.jar                              907.70kB java.lang.String[]
   1.26MB postgresql-42.7.3.jar                              835.24kB byte[] for general heap data
   1.19MB hibernate-validator-8.0.1.Final.jar                792.66kB c.o.svm.core.hub.DynamicHub$ReflectionMetadata
  14.81MB for 119 more packages                                8.23MB for 4577 more object types
------------------------------------------------------------------------------------------------------------------------
Recommendations:
 INIT: Adopt '-H:+StrictImageHeap' to prepare for the next GraalVM release.
 HEAP: Set max heap for improved and more predictable memory usage.
 CPU:  Enable more CPU features with '-march=native' for improved performance.
------------------------------------------------------------------------------------------------------------------------
                       24.7s (9.6% of total time) in 155 GCs | Peak RSS: 5.75GB | CPU load: 6.32
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /home/jaco/IdeaProjects/experiment/gateway/target/native-executable (executable)
========================================================================================================================
Finished generating 'native-executable' in 4m 16s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14:06 min
[INFO] Finished at: 2024-06-27T17:52:00+02:00
[INFO] ------------------------------------------------------------------------

Cloud the problem be related to SLF4J warnings during the build?

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant