Baeldung / spring-security-registration

Go further into "Learn Spring Security":
https://bit.ly/github-lss
MIT License
1.64k stars 1.18k forks source link

unable to start this application with mysql #219

Closed ifthiquarflytxt closed 11 months ago

ifthiquarflytxt commented 1 year ago

o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] web - 2023-07-27 15:28:30,658 [main] ERROR o.s.b.w.e.t.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'secSecurityConfig': Unsatisfied dependency expressed through field 'myAuthenticationSuccessHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myAuthenticationSuccessHandler': Unsatisfied dependency expressed through field 'deviceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceService' defined in URL [jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/com/baeldung/service/DeviceService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GeoIPCity' defined in class path resource [com/baeldung/spring/LoginNotificationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb web - 2023-07-27 15:28:30,710 [main] INFO o.a.c.c.StandardService - Stopping service [Tomcat] web - 2023-07-27 15:28:30,714 [main] WARN o.a.c.l.WebappClassLoaderBase - The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:750) web - 2023-07-27 15:28:30,715 [main] WARN o.a.c.l.WebappClassLoaderBase - The web application [ROOT] appears to have started a thread named [HikariPool-1 connection adder] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467) java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1073) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:750) web - 2023-07-27 15:28:30,717 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat web - 2023-07-27 15:28:30,721 [main] INFO c.z.h.HikariDataSource - HikariPool-1 - Shutdown initiated... web - 2023-07-27 15:28:30,739 [main] INFO c.z.h.HikariDataSource - HikariPool-1 - Shutdown completed. web - 2023-07-27 15:28:30,819 [main] ERROR o.s.b.SpringApplication - Application run failed o.s.c.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat at o.s.b.w.s.c.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) at o.s.c.s.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) at o.s.b.w.s.c.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at o.s.b.SpringApplication.refresh(SpringApplication.java:734) at o.s.b.SpringApplication.refreshContext(SpringApplication.java:408) ... 12 frames truncated Caused by: o.s.b.w.s.WebServerException: Unable to start embedded Tomcat at o.s.b.w.e.t.TomcatWebServer.initialize(TomcatWebServer.java:142) at o.s.b.w.e.t.TomcatWebServer.(TomcatWebServer.java:104) at o.s.b.w.e.t.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:479) at o.s.b.w.e.t.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) at o.s.b.w.s.c.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ... 1 frames truncated ... 16 common frames omitted Caused by: o.s.b.f.UnsatisfiedDependencyException: Error creating bean with name 'secSecurityConfig': Unsatisfied dependency expressed through field 'myAuthenticationSuccessHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myAuthenticationSuccessHandler': Unsatisfied dependency expressed through field 'deviceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceService' defined in URL [jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/com/baeldung/service/DeviceService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GeoIPCity' defined in class path resource [com/baeldung/spring/LoginNotificationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) at o.s.b.f.a.InjectionMetadata.inject(InjectionMetadata.java:119) at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ... 46 frames truncated ... 21 common frames omitted Caused by: o.s.b.f.UnsatisfiedDependencyException: Error creating bean with name 'myAuthenticationSuccessHandler': Unsatisfied dependency expressed through field 'deviceService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deviceService' defined in URL [jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/com/baeldung/service/DeviceService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GeoIPCity' defined in class path resource [com/baeldung/spring/LoginNotificationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) at o.s.b.f.a.InjectionMetadata.inject(InjectionMetadata.java:119) at o.s.b.f.a.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ... 10 frames truncated ... 71 common frames omitted Caused by: o.s.b.f.UnsatisfiedDependencyException: Error creating bean with name 'deviceService' defined in URL [jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/com/baeldung/service/DeviceService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'GeoIPCity' defined in class path resource [com/baeldung/spring/LoginNotificationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.b.f.s.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) at o.s.b.f.s.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ... 9 frames truncated ... 85 common frames omitted Caused by: o.s.b.f.BeanCreationException: Error creating bean with name 'GeoIPCity' defined in class path resource [com/baeldung/spring/LoginNotificationConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.b.f.s.ConstructorResolver.instantiate(ConstructorResolver.java:658) at o.s.b.f.s.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) at o.s.b.f.s.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ... 10 frames truncated ... 98 common frames omitted Caused by: o.s.b.BeanInstantiationException: Failed to instantiate [com.maxmind.geoip2.DatabaseReader]: Factory method 'databaseReader' threw exception; nested exception is java.io.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.b.f.s.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) at o.s.b.f.s.ConstructorResolver.instantiate(ConstructorResolver.java:653) ... 112 common frames omitted Caused by: j.i.FileNotFoundException: class path resource [maxmind/GeoLite2-City.mmdb] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/home/ifthiquar/repo/git/spring-security-registration/target/spring-security-login-and-registration.war!/WEB-INF/classes!/maxmind/GeoLite2-City.mmdb at o.s.u.ResourceUtils.getFile(ResourceUtils.java:217) at o.s.u.ResourceUtils.getFile(ResourceUtils.java:180) at c.b.s.LoginNotificationConfig.databaseReader(LoginNotificationConfig.java:23) at c.b.s.LoginNotificationConfig$$EnhancerBySpringCGLIB$$495cad32.CGLIB$databaseReader$0() at c.b.s.LoginNotificationConfig$$EnhancerBySpringCGLIB$$495cad32$$FastClassBySpringCGLIB$$80cf8ce8.invoke() ... 8 frames truncated ... 113 common frames omitted

ulisseslima commented 11 months ago

Hey, @ifthiquarflytxt.

Please include additional information so we can take a look at this issue:

Article and Module Links A link to the affected article and the affected module. You can find the link to the module in the Conclusion section in the "on Github" standard phase.

Describe the Issue A clear and concise description of what the issue is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected Behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional Context Add any other context about the issue here.

ulisseslima commented 11 months ago

Closing due to inactivity.