Closed joaoandremartins closed 7 years ago
Could you also send your stacktrace?
Just tested it on the latest master
branch (which should be the same for this part, we didn't work at all on this in the last couple of weeks), it started without any issue with Maven.
As you didn't send your stacktrace and as I can't reproduce, I'm closing this
Make sure you have Mongo running locally and configured in your application-*.yml files https://jhipster.github.io/development/#using-a-database
Oh yes @ruddell is probably right -> for this run docker-compose -f src/main/docker/mongodb.yml up -d
in your project
Oh @joaoandremartins I'm just seeing you work at Google NYC, so with my good friend Ray! He's been a great help for the project!!! -> don't hesitate to add more comments, we'll help you, of course
Just for posterity, the stacktrace is below (sorry, I forgot to add it to the original report...).
That command sounds like it's going to help, will give it a go on Monday.
2017-03-17 16:23:24.595 ERROR 53090 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'OAuth2ServerConfiguration.AuthorizationServerConfiguration' defined in file [/usr/local/google/home/joaomartins/workspaces/gfx/target/classes/com/google/gfx/config/OAuth2ServerConfiguration$AuthorizationServerConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfiguration' defined in file [/usr/local/google/home/joaomartins/workspaces/gfx/target/classes/com/google/gfx/config/SecurityConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in file [/usr/local/google/home/joaomartins/workspaces/gfx/target/classes/com/google/gfx/security/DomainUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is org.springframework.dao.DataAccessResourceFailureException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused}}] at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at com.google.gfx.GfxApp.main(GfxApp.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Oh yes you have a timeout while connecting to MongoDB, so that's definitely the issue! You can of course run a "normal" MongoDB (I used to install it on my Mac with Homebrew), but now that we support Docker this is much easier.
Then, maybe we should have a better error message here: you can see it at the end of the Stacktrace, but it's definitely not easy to find & read.
Overview of the issue
Spring Boot app created by jHipster with OAuth2 auth doesn't run out of the box, and fails with an unintuitive exception.
Motivation for or Use Case
This falls short of the premise that apps run out of the box, and isn't trivial to fix. There should at least be documentation somewhere that covers a workaround/what to do.
Reproduce the error
Run the automatically created Spring rule after importing the project to IntelliJ.
Related issues
No
Suggest a Fix
Not sure. Either fix the root cause or document missing steps. From the stack trace, it seems there should be some server running on my machine, and there isn't.
JHipster Version(s)
4.0.8
JHipster configuration
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
Ubuntu