Closed Lakshamana closed 5 years ago
@Lakshamana :
.yo-rc.json
, I couldn't reproduce your issue, it works fine on my computer@pascalgrimaud I can share the JDL, it is here in this link: https://drive.google.com/open?id=1NRKJiZs3T-ipKaCondRlp2fjQIxQVobX. Sorry about the late response! I do not have two instances o MySQL running and that's because they run in port 3306. If I try to run more than one instance I get an error of "bind address already in use"
And here is my application-dev.yml
# ===================================================================
# Spring Boot 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 Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
logging:
level:
ROOT: DEBUG
io.github.jhipster: DEBUG
br.ufpa.labes.spm: DEBUG
spring:
profiles:
active: dev
include:
- swagger
# Uncomment to activate TLS for the dev profile
#- tls
devtools:
restart:
enabled: true
livereload:
enabled: false # we use Webpack dev server + BrowserSync for livereload
jackson:
serialization:
indent-output: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/spm?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC
username: root
password: [password]
hikari:
poolName: Hikari
auto-commit: false
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
database: MYSQL
show-sql: true
properties:
hibernate.id.new_generator_mappings: true
hibernate.connection.provider_disables_autocommit: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.ddl-auto: true
hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.BeanClassLoaderAwareJCacheRegionFactory
data:
elasticsearch:
properties:
path:
home: target/elasticsearch
liquibase:
contexts: dev
mail:
host: localhost
port: 25
username:
password:
messages:
cache-duration: PT1S # 1 second, see the ISO 8601 standard
thymeleaf:
cache: false
server:
port: 8080
# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================
jhipster:
http:
version: V_1_1 # To use HTTP/2 you will need to activate TLS (see application-tls.yml)
cache: # Cache configuration
ehcache: # Ehcache configuration
time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
max-entries: 100 # Number of objects in each cache entry
# CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API
cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-headers: "*"
exposed-headers: "Authorization,Link,X-Total-Count"
allow-credentials: true
max-age: 1800
security:
authentication:
jwt:
# This token must be encoded using Base64 and be at least 256 bits long (you can type `openssl rand -base64 64` on your command line to generate a 512 bits one)
base64-secret: [a secret]
# Token is valid 24 hours
token-validity-in-seconds: 86400
token-validity-in-seconds-for-remember-me: 2592000
mail: # specific JHipster mail property, for standard properties see MailProperties
from: spm@localhost
base-url: http://127.0.0.1:8080
metrics:
logs: # Reports metrics in the logs
enabled: false
report-frequency: 60 # in seconds
logging:
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
enabled: false
host: localhost
port: 5000
queue-size: 512
# ===================================================================
# 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:
If you do need to know, when I run local mysql (without docker) and with a docker elasticsearch instance the app hangs on initial logs as described below:
//Started JHipster and previous database tables...
2019-02-07 15:19:26.527 DEBUG 31167 --- [ restartedMain] c.e.c.E.ufpa.labes.spm.domain.Plugin : Initialize successful.
2019-02-07 15:19:26.530 DEBUG 31167 --- [ restartedMain] c.e.c.E.u.l.s.d.Plugin.theUserPlugins : Initialize successful.
2019-02-07 15:19:26.532 DEBUG 31167 --- [ restartedMain] c.e.c.E.u.labes.spm.domain.UserPlugin : Initialize successful.
2019-02-07 15:19:26.964 DEBUG 31167 --- [ restartedMain] b.u.l.spm.config.LiquibaseConfiguration : Configuring Liquibase
2019-02-07 15:19:27.296 WARN 31167 --- [ spm-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2019-02-07 15:19:32.323 DEBUG 31167 --- [ restartedMain] br.ufpa.labes.spm.config.WebConfigurer : Registering CORS filter
2019-02-07 15:19:32.438 INFO 31167 --- [ restartedMain] br.ufpa.labes.spm.config.WebConfigurer : Web application configuration, using profiles: dev
2019-02-07 15:19:32.438 INFO 31167 --- [ restartedMain] br.ufpa.labes.spm.config.WebConfigurer : Web application fullyconfigured
2019-02-07 15:19:32.857 DEBUG 31167 --- [ restartedMain] b.u.l.spm.security.jwt.TokenProvider : Using a Base64-encoded JWT secret key
2019-02-07 15:19:44.450 DEBUG 31167 --- [ spm-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase has updatedyour database in 17153 ms
2019-02-07 15:19:44.451 WARN 31167 --- [ spm-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Warning, Liquibase took more than 5 seconds to start up!
2019-02-07 15:19:50.931 DEBUG 31167 --- [ restartedMain] i.g.j.c.apidoc.SwaggerAutoConfiguration : Starting Swagger
2019-02-07 15:19:50.943 DEBUG 31167 --- [ restartedMain] i.g.j.c.apidoc.SwaggerAutoConfiguration : Started Swagger in 12ms
And so it hangs on the last line for a loooong time until it throws an error where mysql couldn't get a lock for my database.
@Lakshamana :
At the beginning, I got these warnings:
Maybe related to the issues we recently have with otherEntityRelationshipName ?
It's a 1st analyze, I'll try to go on later.
Hello @Lakshamana,
I've looked at your JDL file and found out that the process hanging was Swagger (the library Springfox here in fact). It seems it took ages to introspect all classes. You can disable this profile in your application-dev.yml, your app should be up pretty quickly as expected.
Let us know if that helps you. This issue could give you some hints but as you'll see, they recommend to use a Spring Profile and use it only during tests... https://github.com/springfox/springfox/issues/811
FYI, I've also used your JDL in the official Vue.js blueprint, thank you as it points me out an issue on entity relationship management.
But Springfox is supposed to run asynchronously, how can it block the app?
Springfox is notoriously slow if you have a lot of entities, this is why I put a log message specifically for this, when it's taking too much time, don't you have it in your logs?
So, @sahbi-ktifa, Thank you (VERY MUCH!) for you hint. I just comment out swagger at spring.profiles.include at application-dev.yml and that did the trick!
Thank you all! Regards.
But my ask now is: how can I generate documentation for my API, considering this issue? Is there a way to run swagger independently out of backend context?
So I checked in jhipster-framework and I was wrong it's not started asynchronously, maybe it could be run the same way as we do for Liquibase?
That would be a proper solution indeed!
@Lakshamana normally you have documentation during dev and turn it off in prod, unless your project is actually providing public APIs to other developers or customers, in that case, you could have swagger on prod as well. But if swagger is causing your app to not start then I suggest you wait for the issue to be fixed in springfox(https://github.com/springfox/springfox/issues/806) or use a compile-time documentation generation strategy using swagger or Spring Rest docs
Btw @pascalgrimaud seems like springfox issue is fixed and they made a release, may be we can upgrade. @Lakshamana can you also try to upgrade the springfox version to latest release and try again
Different things to try:
And we can document it better
We already find some different solutions:
I'm closing this because:
Overview of the issue
When I start my application (in DEV profile) with
sudo docker-compose -f src/main/docker/elasticsearch.yml up -d
andmvn
it hangs in a few log lines for a while before getting an error messageLiquibase could not start correctly, your database is NOT ready: Could not acquire change log lock. Currently locked by 2804:d4b:5c34:4c00:2904:56c4:c2cf:f126%wlp1s0 (2804:d4b:5c34:4c00:2904:56c4:c2cf:f126%wlp1s0) since 2/4/19 5:40 PM
Starting with
sudo docker-compose -f src/main/docker/mysql.yml up -d
too I get the error (see LOG - it's in one on the further sections)Motivation for or Use Case
This is a bug for me 'cause I've been working with JHipster with mysql and elasticsearch in another projects and didn't get such errors before.
Reproduce the error
jhipster
;sudo dockerd
in a terminal window;sudo docker-compose -f src/main/docker/mysql.yml up -d
;sudo docker-compose -f src/main/docker/elasticsearch.yml up -d
;mvn
LOG:
Related issues
Couldn't find one
Suggest a Fix
I didn't figure out yet some solution, but there is a line of stacktrace pointing to refused mysql connections and a line of docker logs that says:
spm-mysql_1 | 2019-02-06T00:45:27.807421Z 5 [Note] Aborted connection 5 to db: 'spm' user: 'root' host: '172.18.0.1' (Got an error reading communication packets)
JHipster Version(s)
I am using JHipster v5.8.1
JHipster configuration
Results for
jhipster info
.yo-rc.json content:
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryI have about 190 entites and it's impracticable to list all files here. However I can share the jdl entities file hosted at Google Drive.
Browsers and Operating System
I am using a Manjaro Linux x86_64 (64-bit SO) in a Dell Inspiron and Firefox Quantum 65.0 Manjaro kernel version number is 4.20.3-1-MANJARO.