0

Thanks In advance.

So I was trying to Deploy the JavaFX app with Maven.

it's giving me this error

[Sat Apr 03 20:52:20 PKT 2021][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
[Sat Apr 03 20:52:24 PKT 2021][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[Sat Apr 03 20:52:34 PKT 2021][INFO] [SUB] [org.quiz.app:13608]    classlist:   8,862.50 ms,  0.96 GB
[Sat Apr 03 20:52:39 PKT 2021][INFO] [SUB] [org.quiz.app:13608]        (cap):   3,337.64 ms,  1.18 GB
[Sat Apr 03 20:52:41 PKT 2021][INFO] [SUB] [org.quiz.app:13608]        setup:   7,150.97 ms,  1.18 GB
[Sat Apr 03 20:53:08 PKT 2021][INFO] [SUB] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[Sat Apr 03 20:53:08 PKT 2021][INFO] [SUB] SLF4J: Defaulting to no-operation (NOP) logger implementation
[Sat Apr 03 20:53:08 PKT 2021][INFO] [SUB] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB] To see how the classes got initialized, use --trace-class-initialization=org.slf4j.LoggerFactory
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB] [org.quiz.app:13608]     analysis:  71,925.59 ms,  3.23 GB
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB] Error: Classes that should be initialized at run time got initialized during image building:
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]  org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]  org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:539)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:226)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:735)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:735)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:471)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[Sat Apr 03 20:53:53 PKT 2021][INFO] [SUB]      at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[Sat Apr 03 20:53:54 PKT 2021][INFO] [SUB] Error: Image build request failed with exit status 1
[Sat Apr 03 20:53:54 PKT 2021][INFO] Additional information: Objectfile should be called org.quiz.app.obj but we didn't find that under F:\JavaFX\QuizApp\QuizApp\QuizApp\QuizApp\target\client\x86_64-windows\gvm
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[Sat Apr 03 20:53:54 PKT 2021][SEVERE] Compiling failed.
[INFO] Total time:  01:46 min
[INFO] Finished at: 2021-04-03T20:53:54+05:00
Check the log files under F:\JavaFX\QuizApp\QuizApp\QuizApp\QuizApp\target\client\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/client/ for more information.

I know why it's giving the error. I am using firebase. so it was few classes that initialize on build time. so how do I avoid it?

I commented on all the firebase code I have done in my project and tested it again then it was working fine. but when I include the firebase again I face this issue. any help please

  • Did you run `mvn client:runagent`? That will give you more complete config files for native-image. Then you can run again `mvn client:build client:run`. – José Pereda Apr 03 '21 at 16:13
  • Maven didn't recognize runagent cmd – Syed Sulaiman Apr 03 '21 at 16:25
  • You need Client plugin 0.1.38 – José Pereda Apr 03 '21 at 16:26
  • okay now it's saying i need higher version of graalvm so let me do setup and I will need your help again Thanks jose Pereda you are amazing – Syed Sulaiman Apr 03 '21 at 16:29
  • I tried to run client:runagent is it's working fine. my app is running perfectly. but I tried to client:build again. it show me error again – Syed Sulaiman Apr 03 '21 at 19:46
  • Error: Classes that should be initialized at run time got initialized during image building: [Sun Apr 04 00:45:16 PKT 2021][INFO] [SUB] org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory – Syed Sulaiman Apr 03 '21 at 19:46
  • Following the [docs](https://docs.gluonhq.com/#_build_time_initialization), you can create a file `src/main/resources/META-INF/substrate/config/initbuildtime`, and add `org.slf4j.LoggerFactory`, then build again? You may need to include more classes, like `org.slf4j.simple.SimpleLogger`, see this [answer](https://stackoverflow.com/a/63833581/3956070). – José Pereda Apr 03 '21 at 20:11
  • It's hard for me to follow documentation. I am very good at the following example. do you know any example which can help? – Syed Sulaiman Apr 03 '21 at 20:18
  • I've already told you what you need to do. Create a text file at that location with that exact name, add those two classes (one per line) – José Pereda Apr 03 '21 at 20:19
  • you mean the txt file alright I'm doing it – Syed Sulaiman Apr 03 '21 at 20:21
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/230709/discussion-between-syed-sulaiman-and-jose-pereda). – Syed Sulaiman Apr 03 '21 at 20:39

1 Answers1

1

Okay! Thanks to Jose Pereda

I found the solution.

so first I created src/main/resources/META-INF/substrate/config/initbuildtime file same directory is must. and initbuildtime is the file name. a file without extension.

after that

<nativeImageArgs>
                 <arg>--allow-incomplete-classpath</arg>
                 <arg>--initialize-at-run-time=io.netty.util.internal.logging.Log4JLogger</arg>
                    </nativeImageArgs>

this code inside the pom.xml file in plugins and that it. my project builds fine. hopefully, this will help the others.

Thanks to Jose Pereda He really helped me a lot. he is great great person.