Blackdread / sql-to-jdl

Tool to translate SQL databases to JDL format of jHipster (Created due to existing databases to be generated with jHipster and build angular-java web)
MIT License
179 stars 81 forks source link

Failed to execute CommandLineRunner, with Postgres #216

Open risavkarna opened 2 weeks ago

risavkarna commented 2 weeks ago

Steps to reproduce:

  1. clean install, followed the readme
  2. in application.yml, add a postgres url
4      url: jdbc:postgresql://localhost:5432/mydb
5      username: someuserhere
6      password: somepasswordhere

Error message received after running mvn:

2024-08-27 23:53:11.885 ERROR 796370 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:774) ~[spring-boot-2.7.4.jar:2.7.4]
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755) ~[spring-boot-2.7.4.jar:2.7.4]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.7.4.jar:2.7.4]
    at org.blackdread.sqltojava.SqlToJavaApplication.main(SqlToJavaApplication.java:46) ~[classes/:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:569) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.4.jar:2.7.4]
Caused by: com.github.mustachejava.MustacheNotFoundException: Template viewsRelations.mustache not found
    at com.github.mustachejava.DefaultMustacheFactory.getReader(DefaultMustacheFactory.java:120) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.MustacheParser.compile(MustacheParser.java:33) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.DefaultMustacheFactory.compilePartial(DefaultMustacheFactory.java:248) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.codes.PartialCode.init(PartialCode.java:86) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.codes.DefaultCode.init(DefaultCode.java:124) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.codes.DefaultMustache.init(DefaultMustache.java:70) ~[compiler-0.9.10.jar:na]
    at com.github.mustachejava.DefaultMustacheFactory.compile(DefaultMustacheFactory.java:180) ~[compiler-0.9.10.jar:na]
    at org.blackdread.sqltojava.service.logic.MustacheService.executeTemplate(MustacheService.java:43) ~[classes/:na]
    at org.blackdread.sqltojava.service.logic.ExportService.exportString(ExportService.java:53) ~[classes/:na]
    at org.blackdread.sqltojava.service.logic.ExportService.export(ExportService.java:114) ~[classes/:na]
    at org.blackdread.sqltojava.SqlToJavaApplication.run(SqlToJavaApplication.java:54) ~[classes/:na]
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) ~[spring-boot-2.7.4.jar:2.7.4]
    ... 8 common frames omitted

2024-08-27 23:53:11.886  INFO 796370 --- [  restartedMain] o.s.i.endpoint.EventDrivenConsumer       : Removing {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2024-08-27 23:53:11.886  INFO 796370 --- [  restartedMain] o.s.i.channel.PublishSubscribeChannel    : Channel 'application.errorChannel' has 0 subscriber(s).
2024-08-27 23:53:11.886  INFO 796370 --- [  restartedMain] o.s.i.endpoint.EventDrivenConsumer       : stopped bean '_org.springframework.integration.errorLogger'
2024-08-27 23:53:11.888  INFO 796370 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2024-08-27 23:53:11.889  INFO 796370 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.636 s
[INFO] Finished at: 2024-08-27T23:53:12+05:45
[INFO] --------------------------------------------------------

my-project-jdl.jh file generated is empty:

// No entities were found for which JDL is to be generated. Please review console logs

Environment:

$ java --version                                                                                                                                                                                             
openjdk 17.0.12 2024-07-16
OpenJDK Runtime Environment Temurin-17.0.12+7 (build 17.0.12+7)
OpenJDK 64-Bit Server VM Temurin-17.0.12+7 (build 17.0.12+7, mixed mode, sharing)

$ mvn --version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /home/rsbn/.sdkman/candidates/maven/current
Java version: 17.0.12, vendor: Eclipse Adoptium, runtime: /home/rsbn/.sdkman/candidates/java/17.0.12-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.10.3-201.fsync.fc40.x86_64", arch: "amd64", family: "unix"
Blackdread commented 2 weeks ago

Hi, sorry, I have no time to help. Specs are green (only failing due to mysql 5.7 which is apparently not available for DL anymore), jdl file is generated, please try to find the issue in your environment.