Error en java developers [Solved]

error en java developers

good

I followed the steps of week 1 and I got this error when executing the application, I have not been able to continue this step I appreciate the collaboration to finish this section

Could you please paste debug messages as it is suggested the line above (mvn spring-boot:run --debug)?

good afternoon

The error that comes to me is the following because it does not let me continue with the exercises. Thank
you for your attention

2019-03-21 16:47:12.510 INFO 9128 — [ main] mflix.Application : Starting Application on DESKTOP-24MFECO with PID 9128 (started by Pc in C:\Users\Pc\Desktop\mongodb\mongodb java\mflix)

2019-03-21 16:47:12.529 INFO 9128 — [ main] mflix.Application : No active profile set, falling back to default profiles: default

2019-03-21 16:47:12.868 INFO 9128 — [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@4f638935: startup date [Thu Mar 21 16:47:12 COT
2019]; root of context hierarchy

2019-03-21 16:47:18.588 INFO 9128 — [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 5000 (http)

2019-03-21 16:47:18.750 INFO 9128 — [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]

2019-03-21 16:47:18.750 INFO 9128 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.31

2019-03-21 16:47:18.774 INFO 9128 — [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program
Files\Java\jre1.8.0_201\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jdk1.8.0_201/bin/…/jre/bin/server;C:/Program Files/Java/jdk1.8.0_201/bin/…/jre/bin;C:/Program Files/Java/jdk1.8.0_201/bin/…/jre/lib/amd64;C:\Program
Files\Java\jdk1.8.0_201\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\nodejs;C:\gradle-4.10.2\bin;C:\spark\spark-2.3.2-bin-hadoop2.7\bin;C:\storm\apache-storm-1.1.3\bin;C:\Users\Pc\AppData\Local\Microsoft\WindowsApps;C:\Users\Pc\AppData\Local\Programs\Microsoft
VS Code\bin;C:\Users\Pc\AppData\Roaming\npm;C:\Program Files\Java\jdk1.8.0_201\bin;C:\spark\spark-2.3.2-bin-hadoop2.7\bin;C:\storm\apache-storm-1.1.3\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.4\bin;C:\storm\zookeeper-3.4.13\bin;C:\Program Files\MongoDB\Server\4.0\bin;;C:\Users\Pc\Downloads\eclipse;;.]

2019-03-21 16:47:19.110 INFO 9128 — [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext

2019-03-21 16:47:19.110 INFO 9128 — [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 6250 ms

2019-03-21 16:47:19.609 INFO 9128 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘characterEncodingFilter’ to: [/*]

2019-03-21 16:47:19.609 INFO 9128 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘hiddenHttpMethodFilter’ to: [/*]

2019-03-21 16:47:19.609 INFO 9128 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘httpPutFormContentFilter’ to: [/*]

2019-03-21 16:47:19.609 INFO 9128 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘requestContextFilter’ to: [/*]

2019-03-21 16:47:19.610 INFO 9128 — [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: ‘springSecurityFilterChain’ to: [/*]

2019-03-21 16:47:19.610 INFO 9128 — [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]

2019-03-21 16:47:25.025 INFO 9128 — [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[cluster0-shard-00-02-yokzg.mongodb.net:27017, cluster0-shard-00-00-yokzg.mongodb.net:27017, cluster0-shard-00-01-yokzg.mongodb.net:27017],
mode=MULTIPLE, requiredClusterType=REPLICA_SET, serverSelectionTimeout=‘30000 ms’, maxWaitQueueSize=500, requiredReplicaSetName=‘Cluster0-shard-0’}

2019-03-21 16:47:25.025 INFO 9128 — [ main] org.mongodb.driver.cluster : Adding discovered server cluster0-shard-00-02-yokzg.mongodb.net:27017 to client view of cluster

2019-03-21 16:47:25.101 INFO 9128 — [ main] org.mongodb.driver.cluster : Adding discovered server cluster0-shard-00-00-yokzg.mongodb.net:27017 to client view of cluster

2019-03-21 16:47:25.102 INFO 9128 — [ main] org.mongodb.driver.cluster : Adding discovered server cluster0-shard-00-01-yokzg.mongodb.net:27017 to client view of cluster

2019-03-21 16:47:25.176 WARN 9128 — [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name ‘movieController’: Unsatisfied dependency expressed through field ‘moviesService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘moviesService’: Unsatisfied dependency
expressed through field ‘movieDao’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘movieDao’ defined in file [C:\Users\Pc\Desktop\mongodb\mongodb java\mflix\target\classes\mflix\api\daos\MovieDao.class]:
Unexpected exception during bean creation; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘spring.mongodb.database’ in value “${spring.mongodb.database}”

2019-03-21 16:47:25.214 INFO 9128 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

2019-03-21 16:47:25.320 INFO 9128 — [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

2019-03-21 16:47:25.340 ERROR 9128 — [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘movieController’: Unsatisfied dependency expressed through field ‘moviesService’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name ‘moviesService’: Unsatisfied dependency expressed through field ‘movieDao’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘movieDao’ defined in file [C:\Users\Pc\Desktop\mongodb\mongodb
java\mflix\target\classes\mflix\api\daos\MovieDao.class]: Unexpected exception during bean creation; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘spring.mongodb.database’ in value “${spring.mongodb.database}”

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1350) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:580) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]

at mflix.Application.main(Application.java:10) [classes/:na]

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘moviesService’: Unsatisfied dependency expressed through field ‘movieDao’; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘movieDao’ defined in file [C:\Users\Pc\Desktop\mongodb\mongodb java\mflix\target\classes\mflix\api\daos\MovieDao.class]: Unexpected exception during bean creation; nested exception is java.lang.IllegalArgumentException: Could
not resolve placeholder ‘spring.mongodb.database’ in value “${spring.mongodb.database}”

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1350) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:580) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

… 19 common frames omitted

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘movieDao’ defined in file [C:\Users\Pc\Desktop\mongodb\mongodb java\mflix\target\classes\mflix\api\daos\MovieDao.class]: Unexpected exception during bean
creation; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘spring.mongodb.database’ in value “${spring.mongodb.database}”

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

… 32 common frames omitted

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder ‘spring.mongodb.database’ in value “${spring.mongodb.database}”

at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:839) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1086) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:818) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:197) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1276) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1133) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]

… 40 common frames omitted

Enviado desde Outlook

Do you have this:
spring.mongodb.database=mflix
in your application.properties file?

jwtSecret=134050f7-9270-436e-9a6d-ddd02f9dd257

jwtExpirationInMs=604800000

spring.mongodb.uri=mongodb+srv://m220student:m220password@cluster0-yokzg.mongodb.net/test

server.port=5000

logging.level.api.controllers=DEBUG

api.movies.movies_per_page=20

spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/build

Enviado desde Outlook

@edinson, it is funny that you show all the values from application.properties except the one that @Jacek_94009 asked you to check.

How come you do not have this line?

How come you did not try to add this line to see if it fix your problem?

Good

I have already validated the code line and it was the error, thank you very much, if another complication comes, iwill ask for your help. Thank you again

Enviado desde Outlook

1 Like