I’m a frontend developer so my knowledge of Java, Spring and IntelliJ is virtually zero.
I accidentally deleted my company’s repo on my local machine so I re-cloned it back from GitHub. I was unable to click the "debug" button as it was grayed out so I asked a colleague what their Run/Debug configurations were and added it to my editor.
Normally, I would click on "debug" and it would run and work with the frontend, but now when I run it this is the error I receive:
updated based on Kaj Hejer recommendation:
Connected to the target VM, address: '127.0.0.1:60174', transport: 'socket'
2021-03-31 13:02:22.350 INFO ['casino-api':main::] c.company.casinoapi.CasinoApiApplication - Starting CasinoApiApplication on Marks-MacBook-Pro.local with PID 7352 (/Users/work/Documents/casino-api/target/classes started by work in /Users/work/Documents/casino-api)
2021-03-31 13:02:22.353 INFO ['casino-api':main::] c.company.casinoapi.CasinoApiApplication - The following profiles are active: local
2021-03-31 13:02:23.781 INFO ['casino-api':main::] o.apache.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
2021-03-31 13:02:23.781 INFO ['casino-api':main::] org.apache.catalina.core.StandardService - Starting service [Tomcat]
2021-03-31 13:02:23.781 INFO ['casino-api':main::] org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.31]
2021-03-31 13:02:23.870 INFO ['casino-api':main::] o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2021-03-31 13:02:23.871 INFO ['casino-api':main::] o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 1480 ms
2021-03-31 13:02:24.171 INFO ['casino-api':main::] io.lettuce.core.EpollProvider - Starting without optional epoll library
2021-03-31 13:02:24.171 INFO ['casino-api':main::] io.lettuce.core.KqueueProvider - Starting without optional kqueue library
2021-03-31 13:02:24.418 INFO ['casino-api':main::] o.f.core.internal.license.VersionPrinter - Flyway Community Edition 6.0.8 by Redgate
2021-03-31 13:02:24.423 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2021-03-31 13:02:24.483 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2021-03-31 13:02:24.500 INFO ['casino-api':main::] o.f.c.internal.database.DatabaseFactory - Database: jdbc:mysql://0.0.0.0:4306/api (MySQL 10.4)
2021-03-31 13:02:24.570 INFO ['casino-api':main::] o.f.core.internal.command.DbValidate - Successfully validated 3 migrations (execution time 00:00.019s)
2021-03-31 13:02:24.583 INFO ['casino-api':main::] o.f.core.internal.command.DbMigrate - Current version of schema `api`: 2
2021-03-31 13:02:24.583 WARN ['casino-api':main::] o.f.core.internal.command.DbMigrate - Schema `api` has a version (2) that is newer than the latest available migration (1) !
2021-03-31 13:02:24.585 INFO ['casino-api':main::] o.f.core.internal.command.DbMigrate - Schema `api` is up to date. No migration necessary.
2021-03-31 13:02:24.674 INFO ['casino-api':main::] o.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default]
2021-03-31 13:02:24.741 INFO ['casino-api':main::] org.hibernate.Version - HHH000412: Hibernate Core {5.4.10.Final}
2021-03-31 13:02:24.871 INFO ['casino-api':main::] org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2021-03-31 13:02:24.981 INFO ['casino-api':main::] org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MariaDBDialect
2021-03-31 13:02:25.139 WARN ['casino-api':main::] org.hibernate.cfg.AnnotationBinder - HHH000457: Joined inheritance hierarchy [com.company.casinoapi.model.game.GameLog] defined explicit @DiscriminatorColumn. Legacy Hibernate behavior was to ignore the @DiscriminatorColumn. However, as part of issue HHH-6911 we now apply the explicit @DiscriminatorColumn. If you would prefer the legacy behavior, enable the `hibernate.discriminator.ignore_explicit_for_joined` setting (hibernate.discriminator.ignore_explicit_for_joined=true)
2021-03-31 13:02:25.893 INFO ['casino-api':main::] o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-03-31 13:02:26.260 WARN ['casino-api':main::] o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-03-31 13:02:26.502 WARN ['casino-api':main::] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameReportController': Unsatisfied dependency expressed through field 'jwtAuthenticator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
2021-03-31 13:02:26.505 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2021-03-31 13:02:26.522 INFO ['casino-api':main::] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
2021-03-31 13:02:26.550 INFO ['casino-api':main::] org.apache.catalina.core.StandardService - Stopping service [Tomcat]
2021-03-31 13:02:26.564 ERROR ['casino-api':main::] o.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gameReportController': Unsatisfied dependency expressed through field 'jwtAuthenticator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.company.casinoapi.CasinoApiApplication.main(CasinoApiApplication.java:10)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'globalJWTConfig' defined in class path resource [com/company/casinoapi/config/JWTAuthConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
... 19 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.casinoapi.bean.JWTAuthenticator]: Factory method 'globalJWTConfig' threw exception; nested exception is java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
... 32 common frames omitted
Caused by: java.nio.file.NoSuchFileException: src/main/resources/secrets/api-engine-secret.key
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:370)
at java.base/java.nio.file.Files.newByteChannel(Files.java:421)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
at java.base/java.nio.file.Files.newInputStream(Files.java:155)
at java.base/java.nio.file.Files.newBufferedReader(Files.java:2838)
at java.base/java.nio.file.Files.readAllLines(Files.java:3329)
at com.company.casinoapi.bean.JWTAuthenticator.<init>(JWTAuthenticator.java:28)
at com.company.casinoapi.config.JWTAuthConfig.globalJWTConfig(JWTAuthConfig.java:17)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081.CGLIB$globalJWTConfig$0(<generated>)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081$$FastClassBySpringCGLIB$$f2f1d21b.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at com.company.casinoapi.config.JWTAuthConfig$$EnhancerBySpringCGLIB$$8d9d3081.globalJWTConfig(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 33 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:60174', transport: 'socket'
Process finished with exit code 1
2
Answers
In the stacktrace you can see the following:
It looks like you app is trying to connect to a redis-server. I suggest you hear with your colleague how they start the redis-server.
First you need to add
api-engine-secret.key
file to your project in the pathsrc/main/resources/secrets
, maybe this file not pushed to GitHub repository, So you need to get it from a colleague.