Closed mraible closed 2 years ago
Iโm actually planning to add a modular generator. Should be simple, but itโs a start.
I took a look at the steps. The modular generator will not help at the current state.
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days
I hope to work on this in a couple of weeks.
On Sat, Oct 30, 2021 at 18:07 github-actions[bot] @.***> wrote:
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs ๐. Comment or this will be closed in 7 days
โ You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/16498#issuecomment-955610934, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAELZABRX2OP3IWMZ3HYMDUJSCDLANCNFSM5FDFMRLA .
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days
I plan to start this next week. I was hoping we could upgrade to Spring Boot 2.6 first, but that might be difficult.
Spring Native 0.11.0 should be released next week so good timing.
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs :smiley:. Comment or this will be closed in 7 days
Still plan to work on this once Spring Boot 2.6 is integrated.
On Fri, Dec 31, 2021 at 17:08 github-actions[bot] @.***> wrote:
This issue is stale because it has been open 30 days with no activity. Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted. We are accepting PRs ๐. Comment or this will be closed in 7 days
โ Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/16498#issuecomment-1003470902, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAELZEJGOQYJP6MX2OWF3LUTZAXFANCNFSM5FDFMRLA . You are receiving this because you authored the thread.Message ID: @.***>
Latest jhipster has SB 2.6.3 ๐ watching this
@jhipster/developers Is our create a module guide up-to-date? I'd like to start creating this module today.
@mraible I would create a blueprint instead. IMO we should drop module at v8, there is no advantage on implementing a module. A blueprint acts as a module when using a custom command/generator.
@mshima If I create a blueprint, it'd likely only replace some values in needles. I suppose it might need to add files too.
Spring Boot 3 won't have a need for Spring Native because it'll be native by default. So that's something to consider - this likely won't be needed for JHipster 8 if it includes Spring Boot 3.
Another option would be to integrate Spring Native by default. Here's the current list of things you need to do to integrate it with JHipster v7.6. In my experience, integrating native does not cause any issues with JVM-mode. It's only activated when you run -Pnative
.
Some of these issues might be bugs in Spring Native. https://github.com/spring-projects-experimental/spring-native/issues/1378#issuecomment-1029588660
@mraible I can generate the initial blueprint if you want me to do it.
@mshima I'd love your help!
@mraible to regenerate your examples:
npm install -g mshima/generator-jhipster-native
jhipster-native --with-entities --skip-jhipster-dependencies
@mshima I tried it by running rm -rf
in one of my example projects, then jhipster-native --with-entities
. The result:
Changes to package.json were detected.
Running npm install for you to install the required dependencies.
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/generator-jhipster-native - Not found
npm ERR! 404
npm ERR! 404 'generator-jhipster-native@0.0.0' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mraible/.npm/_logs/2022-02-05T19_06_24_435Z-debug.log
ERROR! Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
at makeError (/usr/local/lib/node_modules/generator-jhipster-native/node_modules/yeoman-environment/node_modules/execa/lib/error.js:60:11)
at handlePromise (/usr/local/lib/node_modules/generator-jhipster-native/node_modules/yeoman-environment/node_modules/execa/index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
shortMessage: 'Command failed with exit code 1: npm install',
command: 'npm install',
escapedCommand: 'npm install',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Would a clone and npm link
work better?
Need to use --skip-jhipster-dependencies
flag. The blueprint is not released.
I got a bit further. This time, it succeeded in creating the project, but fails to run it.
jhipster: Compilation failure: Compilation failure:
[ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[38,104] cannot find symbol
[ERROR] symbol: variable idToken
[ERROR] location: class com.mycompany.myapp.web.rest.LogoutResource
[ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[43,21] variable idToken is already defined in method prepareLogoutUri(org.springframework.http.server.reactive.ServerHttpRequest,org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.core.oidc.OidcIdToken)
[ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[43,31] cannot find symbol
[ERROR] symbol: variable oidcUser
[ERROR] location: class com.mycompany.myapp.web.rest.LogoutResource
[ERROR] -> [Help 1]
I got a bit further. This time, it succeeded in creating the project, but fails to run it.
jhipster: Compilation failure: Compilation failure: [ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[38,104] cannot find symbol [ERROR] symbol: variable idToken [ERROR] location: class com.mycompany.myapp.web.rest.LogoutResource [ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[43,21] variable idToken is already defined in method prepareLogoutUri(org.springframework.http.server.reactive.ServerHttpRequest,org.springframework.security.oauth2.client.registration.ClientRegistration,org.springframework.security.oauth2.core.oidc.OidcIdToken) [ERROR] /Users/mraible/dev/spring-native-examples/spring-native-webflux/src/main/java/com/mycompany/myapp/web/rest/LogoutResource.java:[43,31] cannot find symbol [ERROR] symbol: variable oidcUser [ERROR] location: class com.mycompany.myapp.web.rest.LogoutResource [ERROR] -> [Help 1]
Reactive LogoutResource needed adjusts. Reinstalling should fix it.
PS: I am not really trying to run the applications. I am following the steps and matching the examples, and doing generator-jhipster blueprint support adjusts. Will do that later this week or next.
Thanks for the fix @mshima! I tested all of the apps today:
spring-native-webflux
- โ
spring-native-mvc
- โ
angular-webflux
- โ
postgres-webflux
- โ
postgres-mvc
- โ
I'll create a PR with some minor improvements to the blueprint.
We probably should move the blueprint to jhipster org.
Or hipster-labs due to GitHub actions. The build is not completing in 35min ๐ฎ .
@mshima I figured out how to get R2DBC repositories to work! I had to add @Component
to each Impl class and add SimpleR2dbcRepository
as a type hint. See specifics in https://github.com/mraible/spring-native-examples/pull/7.
I also noticed that the JHipster Native blueprint does not add Liquibase information to the postgres-webflux
example, so we might need to adjust some install logic there. I also had to add a typeName for Liquibase + WebFlux:
typeNames = "com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[]"
@mshima I found another thing that needs to be added. If CacheConfiguration
is activated, it fails to compile with the following error.
[ERROR] Failed to execute goal org.springframework.experimental:spring-aot-maven-plugin:0.11.2:generate (generate) on project flickr-2: Build failed during Spring AOT code generation: Unable to execute mojo: Compilation failure
[ERROR] /Users/mraible/dev/auth0-full-stack-java-example/target/generated-runtime-sources/spring-aot/src/main/java/org/springframework/cache/annotation/ContextBootstrapInitializer.java:[24,56] cannot find symbol
[ERROR] symbol: method setConfigurers(java.lang.Object)
[ERROR] location: variable bean of type org.springframework.cache.jcache.config.ProxyJCacheConfiguration
[ERROR] -> [Help 1]
If I add @Profile("!native")
to CacheConfiguration
, my app compiles. However, when I try to run it after building it, I still get an error:
2022-02-06 22:04:13.178 ERROR 25028 --- [ main] org.hibernate.AssertionFailure : HHH000099: an assertion failure occurred (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): java.lang.NullPointerException
2022-02-06 22:04:13.186 ERROR 25028 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Invocation of init method failed; nested exception is org.hibernate.AssertionFailure: Error calling ServiceLoader.Provider.type()
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908) ~[na:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[na:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[native-executable:2.6.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414) ~[native-executable:2.6.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[native-executable:2.6.3]
at com.auth0.flickr2.Flickr2App.main(Flickr2App.java:80) ~[native-executable:na]
Caused by: org.hibernate.AssertionFailure: Error calling ServiceLoader.Provider.type()
at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.collectServiceIfNotDuplicate(AggregatedServiceLoader.java:272) ~[na:na]
at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.loadAll(AggregatedServiceLoader.java:201) ~[na:na]
at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.getAll(AggregatedServiceLoader.java:187) ~[na:na]
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:251) ~[na:na]
at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.buildSelector(StrategySelectorBuilder.java:105) ~[na:na]
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:232) ~[na:na]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:479) ~[na:na]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:222) ~[na:na]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:182) ~[na:na]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:52) ~[na:na]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[na:na]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409) ~[na:na]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396) ~[na:na]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[na:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[na:na]
... 14 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.collectServiceIfNotDuplicate(AggregatedServiceLoader.java:269) ~[na:na]
... 29 common frames omitted
Upon further review, it seems that the profile annotation does not work and I have to comment out these annotations in CacheConfiguration
.
@Configuration
@EnableCaching
This still results in the same error as above. I also tried to disable Hibernate's 2nd level cache in application.yml
.
hibernate.cache.use_second_level_cache: false
That doesn't seem to help either. I'll continue investigating.
Added warnings for untested configurations.
Good idea. I had to remove caching for things to work. I added a workaround to my instructions. I believe this is because Spring Native doesn't support caching yet.
@mshima If you transfer your repo to @jdubois, he can transfer it to the JHipster org.
@mshima If you transfer your repo to @jdubois, he can transfer it to the JHipster org.
Done
And the transfer to the org is done! Thanks!
On 11 Feb 2022, at 00:10, Marcelo Shima @.***> wrote:
@mshima https://github.com/mshima If you transfer your repo to @jdubois https://github.com/jdubois, he can transfer it to the JHipster org.
Done
โ Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/16498#issuecomment-1035626180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACNLI7YHWJA27D2U36H6T3U2RAVLANCNFSM5FDFMRLA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.
Just so folks know when reading this conversation, the blueprint is located at https://github.com/jhipster/generator-jhipster-native.
@mraible @mshima Closing this issue since blueprint is now available ;)
Please grab the bug bounty for this one @mshima!
Bug bounty claimed https://opencollective.com/generator-jhipster/expenses/83301
@mshima: approved
Overview of the feature request
Create a module to add Spring Native support to JHipster apps.
Motivation for or Use Case
Josh Long and I figured out the necessary steps this week and documented them in mraible/spring-native-examples. I also published an article about our experience on LinkedIn.
Related issues or PR
https://github.com/jhipster/generator-jhipster/issues/13733