You seriously deserve an like and subscribe. You teach the way it actually help to learn than just showing how one do it its more like how its must be done. Thanks for the great tutorial :)
THANK YOU SO MUCH. Pros: - Great hands on explanation - No fluff, just stuff Cons: - BG music - Sometimes the scrolling between IDEs is too fast (so unable to see which layer has what port number) - but managed to pause the find the info. Overall I enjoyed watching the full video. Better than some videos I have seen on pluralsight.com Keep up the good work buddy!!
Excellent !!! In fact resolving the errors (while running the server) due to incorrect port number, made the video revisit the configuration, which could have been missed out while watching :-). Excellent again !!!
Hi, great job, thanks! Some people talk about noisy music at background, but I personally think, it was calming and fitted well, so please, don't remove it)
Nice tutorial. If you can give the links for your other tutorials in the description, it would be easy to refer. I could not find a separate video from you on zuul proxy as you have mentioned in this tutorial.
Thanks for the tutorial. Is there any tutorial shared by you to show the communication between microservices using eureka on kubernetes (any cloud). If yes please share the link.
@@TechPrimers Thanks for the reply. This tutorial is not including eureka server but the it is helpful in understanding the communication between microservices. I have seen a lot of examples where eureka is used and in eureka server we have to provide a url of eureka server in properties. I am trying to understand how that url part will be handled in kubernetes (cloud) because in local machine it is localhost but in kubernetes it should be pod url. Please share your thoughts. Thanks
When you want to open a Maven project in IntelliJ, select the 'pom.xml' file and open it as a project. IntelliJ will automatically pickup that it's a Maven project. If you select just the folder, generally it won't recognise that it's a Maven project at first.
GREAT tutorial!!! Very clear & well explained. (Like others said, background sound was a bit loud but I'm sure that can be fixed next time. One way to control that sound is to record the video without background, then add background sound during the video mixing so you can keep it on a separate audio channel & control its volume when needed)
if you're getting a timezone error for mysql, try this line in your application.properties file : spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=EST5EDT
Hello Ajay, Thank you for wonderful tutorials. Explanation was very good with easy examples. At 4:16, you mentioned that you have prepared videos of what is Eureka and What is Zuul. I tried to find those videos, but didn't catch them. Can you please share link of those videos.
This is an excellent resource Ajay. It's true the background music is a little disconcerting but if you just lower it without muting it I think it does help to concentrate the mind. It's a real find of a video. Inclusive of the resources you mention in the title, you cover start.spring.io, Java 8 streams and display a excellent working knowledge of Intellij. Thanks and well done.
Excellent explanation. I am trying to setup project based on above explanation. I get following error after setting up Hiberante The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_241] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_241] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_241] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_241]
Hi @techprimers_admin, nice explanation, And also I was wondering what’s the software you use for your presentations where the images/text will get step by step instead of all at a time in ppt. One you used above during 1:58 where the boxes (components) are coming just like magical that too in single page.. thank you.
Hi, Could you explain the reason for embedding zuul proxy in eureka server ? What is the strategy of running these two process in same service/instance ? Can i use this same strategy in production environment ? What type of discovery is this pattern ? Your architecture diagram look likes Server - Side Discovery but implementation looks like Client-Side discovery. Thanks in advance.
Hi, I am getting Caused by: java.sql.SQLException: Unknown system variable 'tx_isolation' exception and not able to resolve. Need some help please. Thanks Jayasree
Really very nice Tutorial. well explained, Thanks mate. For Eureka server, your 8080 port was in used not 8761. You don't need to change your port cause your 8080 was already in use taken by tomcat server by default, therefore, it was showing an error. Running Eureka server at 8761 will not work. it's tomcat which brings this server up. When you change the Tomcat server port it started running fine.
1. Can hosting a seperate DB service be optimised further ? I mean can we not create a jar of this service and ask the consuming services like quote mgmt service to use it as a maven dependency , we can save the network calls then . What do u think ?
Yes Nishanth, that's possible however the only downside to that is, if the database changes, then every consuming client app needs to upgrade the jar to latest version. It will work for small teams, May not work for bigger organizations since each team will have their own roadmap and priorities. Getting all of them insync will be challenging
@@TechPrimers ohh I see , then for bigger teams , your approach yes does outweigh the Maven approach . But this comes with a network overhead . Do we then employ here the following strategies to keep NFRs intact : 1. Scalability : service containerisation would do 2. Since db service will be called by the service for most of the operations for which user has to wait on the screen , we can use rsocket to keep a connection pooling for better response times ? I may be wrong in this point . 3. When deploying db-service , we deploy a new service instance and then de comission the old one ? Sorry if the queries are large . I am working in a small team hence not able to envision the requirements of a larger team .
hello... I have implemented zuul gateway which helps to call microservices .but the doubt is I want to apply like, I have authenticated service which implements JWT, and some other micro services. now I want to check before every request from zuul - URL is the user already logged in or not if the user already logged in then able call other microservices or APIs else return login UI. please give me some reference or hit to do this.thank you in advance,
Hi I am using AWS ecs to deploy springboot microservice application and I am able to do. But how to deploy using eureka server and client. I search in google but didn't get any proper blog to deploy eureka in aws. Please someone help me what are the changes needed to deploy eureka in AWS.
Hi Ajay, it appears a bit fuzzy to me the difference between SOA and microservices. But, as I understand, the main differences are that microservices are more fine-grained than SOA, and each microservice has an indipendent database layer. In this example, we have 2 microservices that are using the same database layer. So, isn't this going more towards SOA than real microservices, and what is the best approach? Thanks a lot for your great videos. Valentino
I am getting the below error in db-service., could you please help 2018-05-22 21:43:34.706 ERROR 9445 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool. java.sql.SQLException: Unknown system variable 'tx_isolation'
Hi , when I am converting DB service application as eureka client , every times it fails causing java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'. , hibernate session factory and related exception , whereas when i comment out the @Enable eureka client it starts working fine, I added the dependencies as mentioned and also tried changing the version of the spring-boot dependency
I have followed your lecture carefully but not able to start the server and application. getting error 1. Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource: reason : Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader 2. Failed to load ApplicationContext 3.Application run failed
Eu tenho 1 problema ao tentar logar mandar uma requisicao pro curso. Eu ainda tomo erro 401 e debugando eu identifiquei que no setSecurityContext da class SecurityContextUtil.java, eu nao tenho JWTClaimsSet. Nao sei onde pode ser o problema.
How in microservice architecture two services communicate each other ? and if any exception through one service which is dependent on other service how we will handle the exception ??
Hi Tech Primers, How would you secure your services ? Could you help me in understanding, what could be the good architecture to implement authentication and authorization in micro services, assuming application is both B2B and C2B.
Hi Ajay, when I start the stock-service I get the following message and the application fails to start Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). For stock service we dont need to configure the database right? Request you to help me out here
Getting exception on following line in delete method @PostMapping("/delete/{username}") public List delete(@PathVariable("username") final String userName){ List quotes = quoteRepository.findByUserName(userName); quoteRepository.delete(quotes); // in CurdRepository cannot be applied. return getQuotesByUserName(userName); } Let me know if i'm missing something And I've not seen any delete(List obj) method in CurdRepository.
while making a video for developer main challenge is to solving exception, you should explain how to resolve those exception as well, in delete method how can we pass a list type object reference in List quotes = quotesRepository.findByUserName(username); // quotesRepository.delete(quotes); this line I am getting error stating that this quotes should be Quotes type rather a list type, and I was commenting that piece of code and I am getting error while hit the url in postman getting this error, { "timestamp": "2019-04-18T15:18:32.024+0000", "status": 500, "error": "Internal Server Error", "message": "No message available", "path": "/rest/db/add" } Please help to resolve this
Let assume we have 30 microservices, so one instance of eureka server can not handle the all request. so we have to go for multiple instance of eureka server. my question is how to configure multiple instance of eureka server and how to register microservices with them?
Hello my friend, i have a error in de DbServiceResource, line "quotesRepository.delete(quotes)", the sistem told me "The method delete(Quote) in the type CrudRepository is not applicable for the arguments (List)" What can be wrong with my code?
Hi Ajay Great tutorial! Specifically learned about the usage of Zuul - Netflix's JVM based router and server side load balancer. Also learned about client-side service discovery using Spring Cloud Netflix Eureka. By the way, the music you play in the background is pretty cool. Sets the mood to write code :) Can you share the name of the music? ;) Thanks!
Thank you Tariq. Glad to hear that. :) In this video the music is here: brokeforfree.bandcamp.com/track/day-bird Most of videos are from Joakim Karud (you can search in soundcloud.com for his tracks)
Really nice video. I watched both of them and liked them as well. good information is filled in less time along with Architecture diagram. One of the best videos to learn Spring boot concepts. -$
Hi, Thanks for the hands on tutorial. Just one doubt. Don’t you think the database should associate with each micro services instead one common dB services for two micro services?
If so then how will it be different then the monolithic architecture where all the services is referring single database. If we follow the one you are saying, it will be monolithic service sooner than later. Isn't it?
Hi I am trying to build Eureka service, facing error as "No bean found of type 'com.netflix.appinfo.ApplicationInfoManager' " Class in Maven dependency is present. Could you please help. Thanks
Hi, thanks for the video. A little help would be appreciated. My db-service works fine. when i run my stock-service, it doesn't startup saying it has some error getting CloudEurekaClient. I was wondering if you took some steps to setup Eureka, I understand that the Eureka server is not yet up and running and the stock-service should startup just fine but somehow my stock-service doesn't startup Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException some useful error messages 2018-01-19 18:54:00.414 INFO 682 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=21ae6e73,type=ConfigurationPropertiesRebinder] 2018-01-19 18:54:00.439 INFO 682 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2018-01-19 18:54:00.449 INFO 682 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2018-01-19 18:54:00.508 INFO 682 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2018-01-19 18:54:00.536 ERROR 682 --- [ main] o.s.c.n.e.s.EurekaRegistration : error getting CloudEurekaClient org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient!
hello thanks for tutorial. If we put eureka and zuul in the same microservices, how to prevent client access to localhost:8003/eureka dashboard. because we need to open this api to world wide web. now everyone can see our service registiry right?
Hi, I am facing below error, while bringing up stock-service, please help org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException
why do we need to register db service instance too as a client ? because anwway we are gonna access via stock price service right. Is there any specific purpose behind this registration?
+surendirababu janarthanan Yes. We don't have to hard code URL of Db service in stock service, hence we register db service to Eureka and access it from there. If DB service is deployed in different port, we don't have to do a code change in stock service. Hence this architecture pattern is followed
Hi Tech Primer, let me complement you first by saying "both the videos you posted on Micro services were simply superb". I am an AWS Architect who is learning Spring Boot from your lectures. Can you help me in resolving few questions on a complex AWS architecture diagram? I am looking forward to integrating AWS API-Gateway REST services with Spring Boot.
I am getting this error it is not getting auto wired Parameter 0 of constructor in com.learnspring.stock.dbservice.resource.DbServiceResource required a bean of type 'com.learnspring.stock.dbservice.repository.QuoteRepository' that could not be found
You setup database connection properties but where is the MySql database? Is it been created automatically. If it is created automatically but I got some errors like: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at com.subaratabio.dbservice.DbServiceApplication.main(DbServiceApplication.java:12) [classes/:na]
Yes Subrata, the tables are created automatically when you have auto-dll as 'update'. can you provide the code which you are using (you can upload the project to GitHub). Also you check my example from the Github link in the description
Thanks bro for instant replay, for the sake of better understand, I uploaded my code into Github. Please kindly check it and help me for further process. github.com/Subarata-Talukder/Spring-Microservice
The issue is due to Autowiring problem in DbServerService.java. github.com/Subarata-Talukder/Spring-Microservice/blob/master/db-service/src/main/java/dbresource/DbServerService.java Add Constructor Injection or @Autowire for the QuotesRepo variable.
After applying your suggestion but it is returning errors like. Could you explain it (One thing I forgot to inform you, I am developing this project on Ubuntu Linux based Machine) org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at com.subaratabio.dbservice.DbServiceApplication.main(DbServiceApplication.java:12) [classes/:na] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] ... 16 common frames omitted Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to open JDBC connection for schema management target at org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:42) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:57) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] ... 22 common frames omitted Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144] at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.MysqlIO.(MysqlIO.java:341) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2192) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2225) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2024) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779) ~[mysql-connector-java-5.1.42.jar:5.1.42] at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.42.jar:5.1.42] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:38) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] ... 28 common frames omitted Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_144] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_144] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~ ............
The @EnableJpaRepositories has incorrect package name. You have to put the package of the QuotesRepo. which is "reporesource". Change that. The error says its not able to load the Quote entity into the Repo since its not able to identify it as a jparepository
I've imported the Maven project and launched the Eureka service then the DB service. 1. Launching the Eureka service is a success. 2. Launching the DB service is a success (I've modified the application.properties to connect to my MySQL database). However, after I launch the DB service, the Eureka service keeps throwing exception: ERROR 3146 --- [et_localhost-17] c.n.e.cluster.ReplicationTaskProcessor : Network level connection to peer localhost; retrying after delay com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused localhost:8302 gives me: Application: DB-SERVICE AMIs: n/a (1) Available Zones: (1) Status: UP (1) - 192.168.1.4:db-service:8300 EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.
What is the advantage of having db-service.? We can create a seperate project for data jpa (entities, repositories) and add dependency in micro services. Right? Please let me know
that way our DB and its relevant microservice is separate. else, if there is a Table change, you need to update all microservices to use the new dependency verison.
⏱ Chapter Timestamps
====================
0:00 - Intro
0:46 - Architecture
8:36 - Creation of db-service
25:29 - Testing db-service
27:47 - Deletion feature in db-service
30:50 - Creation of stock-service
47:39 - Testing stock-service
52:15 - Creation of eureka-service
56:39 - Eureka Dashboard
57:34 - Enable Eureka in stock-service
59:31 - Enable Eureka in db-service
The best thing about the tutorial we can see what errors might come during setup, thank you techprimer to make such videos not readymade things.
great tutorial - wish there was no music..it is very distracting..Keep posting more
You seriously deserve an like and subscribe. You teach the way it actually help to learn than just showing how one do it its more like how its must be done. Thanks for the great tutorial :)
Thanks for the presentation. Its nice & to the point for someone who wants to quick start on Micro Services using Spring Boot.
I would say it's the best video with eureka and zuul implementation. Thanks :)
Wow. Excellent session which covers clearly what it is intended to. Kudos to tutor.
THANK YOU SO MUCH.
Pros:
- Great hands on explanation
- No fluff, just stuff
Cons:
- BG music
- Sometimes the scrolling between IDEs is too fast (so unable to see which layer has what port number) - but managed to pause the find the info.
Overall I enjoyed watching the full video. Better than some videos I have seen on pluralsight.com
Keep up the good work buddy!!
Excellent !!!
In fact resolving the errors (while running the server) due to incorrect port number, made the video revisit the configuration, which could have been missed out while watching :-).
Excellent again !!!
Thank! This is the best in the open spaces of the site, the explanation is simple and clear Thank you!
This is a wonderful technology channel.
Thank you. Glad its useful
Hi, great job, thanks!
Some people talk about noisy music at background, but I personally think, it was calming and fitted well, so please, don't remove it)
Amazing video ..simply followed the steps and application worked perfectly . Also got the understanding of Netflix Eureka. Great tutorial!!
Thanks Surabhi. Glad that was helpful
sir do u have database regarding this project?
Neat and clean explanation. Thanks for the video.
superb tutorial .. n grt background music .. very helpful
Nice tutorial. If you can give the links for your other tutorials in the description, it would be easy to refer. I could not find a separate video from you on zuul proxy as you have mentioned in this tutorial.
Thanks for the tutorial. Is there any tutorial shared by you to show the communication between microservices using eureka on kubernetes (any cloud). If yes please share the link.
Does this video suffice Deepak? - ua-cam.com/video/icyHIjfgYRY/v-deo.html
@@TechPrimers Thanks for the reply. This tutorial is not including eureka server but the it is helpful in understanding the communication between microservices. I have seen a lot of examples where eureka is used and in eureka server we have to provide a url of eureka server in properties. I am trying to understand how that url part will be handled in kubernetes (cloud) because in local machine it is localhost but in kubernetes it should be pod url. Please share your thoughts. Thanks
NO issue.1st part Worked perfectly as shown. Currently running Spring Boot 2.0
sir can u share me database related to this project
Good tutorial but background is disturbing.
Background music u mean?? Cos I personally liked this dark background (developers obsession) ;-)
Infact the background music help reduce the monotonous work. i liked it.
Please repost but no background music. ? Thanks
When you want to open a Maven project in IntelliJ, select the 'pom.xml' file and open it as a project. IntelliJ will automatically pickup that it's a Maven project. If you select just the folder, generally it won't recognise that it's a Maven project at first.
thanks for the tip Artemas
Very nice tutorial.. Thanks... waiting for upcoming videos..
Very nicely explained.......Awesome :)
Thanks a lot
You are awesome buddy. I really love the way you code. Especially Java8.
#MicroServices #Spring-Boot #Spring-Cloud #Java8
Nice video ... Ajay..learnt lot of things in very less time.
At 29:28, how are you not getting a compilation time error for delete if delete() should only accept 1 Quote?
I solved the compilation error by writing the below code. quotes.stream()
.forEach(quote -> quotesRepository.delete(quote));
GREAT tutorial!!! Very clear & well explained.
(Like others said, background sound was a bit loud but I'm sure that can be fixed next time. One way to control that sound is to record the video without background, then add background sound during the video mixing so you can keep it on a separate audio channel & control its volume when needed)
Good Job...Please add some advanced level videos on microservices covering Zipkin & hystrix.
sure wil do neeraj
Awesome tutorial. Many thanks. Kindly keep the background music low when uploading more tutorials.
if you're getting a timezone error for mysql, try this line in your application.properties file :
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=EST5EDT
Hello Ajay, Thank you for wonderful tutorials. Explanation was very good with easy examples. At 4:16, you mentioned that you have prepared videos of what is Eureka and What is Zuul. I tried to find those videos, but didn't catch them. Can you please share link of those videos.
Best demo I have ever seen
This is an excellent resource Ajay. It's true the background music is a little disconcerting but if you just lower it without muting it I think it does help to concentrate the mind. It's a real find of a video. Inclusive of the resources you mention in the title, you cover start.spring.io, Java 8 streams and display a excellent working knowledge of Intellij. Thanks and well done.
Thanks mark. Yeah. all new videos don't have the music.
Excellent explanation. I am trying to setup project based on above explanation. I get following error after setting up Hiberante
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_241]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_241]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_241]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_241]
Hi @techprimers_admin, nice explanation,
And also I was wondering what’s the software you use for your presentations where the images/text
will get step by step instead of all at a time in ppt. One you used above during 1:58 where the boxes (components) are coming just like magical that too in single page.. thank you.
I use Google Slides kishore. Yes its a mixture of component animations and slide transitions
Hi,
Could you explain the reason for embedding zuul proxy in eureka server ? What is the strategy of running these two process in same service/instance ? Can i use this same strategy in production environment ? What type of discovery is this pattern ? Your architecture diagram look likes Server - Side Discovery but implementation looks like Client-Side discovery. Thanks in advance.
Such a nice tutorial. Thanks man
Hi, I am getting Caused by: java.sql.SQLException: Unknown system variable 'tx_isolation' exception and not able to resolve. Need some help please.
Thanks
Jayasree
Can you do one video on sagas design pattern with Spring boot based code example? Thank you and much appreciated.
Awesome ! So simple and fast :) keep rocking
Really very nice Tutorial. well explained, Thanks mate. For Eureka server, your 8080 port was in used not 8761. You don't need to change your port cause your 8080 was already in use taken by tomcat server by default, therefore, it was showing an error. Running Eureka server at 8761 will not work. it's tomcat which brings this server up. When you change the Tomcat server port it started running fine.
1. Can hosting a seperate DB service be optimised further ? I mean can we not create a jar of this service and ask the consuming services like quote mgmt service to use it as a maven dependency , we can save the network calls then . What do u think ?
Yes Nishanth, that's possible however the only downside to that is, if the database changes, then every consuming client app needs to upgrade the jar to latest version. It will work for small teams, May not work for bigger organizations since each team will have their own roadmap and priorities. Getting all of them insync will be challenging
@@TechPrimers ohh I see , then for bigger teams , your approach yes does outweigh the Maven approach . But this comes with a network overhead . Do we then employ here the following strategies to keep NFRs intact :
1. Scalability : service containerisation would do
2. Since db service will be called by the service for most of the operations for which user has to wait on the screen , we can use rsocket to keep a connection pooling for better response times ? I may be wrong in this point .
3. When deploying db-service , we deploy a new service instance and then de comission the old one ?
Sorry if the queries are large . I am working in a small team hence not able to envision the requirements of a larger team .
hello...
I have implemented zuul gateway which helps to call microservices .but the doubt is I want to apply like,
I have authenticated service which implements JWT, and some other micro services. now I want to check before every request from zuul - URL is the user already logged in or not if the user already logged in then able call other microservices or APIs else return login UI.
please give me some reference or hit to do this.thank you in advance,
Hi
I am using AWS ecs to deploy springboot microservice application and I am able to do.
But how to deploy using eureka server and client.
I search in google but didn't get any proper blog to deploy eureka in aws.
Please someone help me what are the changes needed to deploy eureka in AWS.
Hi Ajay, it appears a bit fuzzy to me the difference between SOA and microservices. But, as I understand, the main differences are that microservices are more fine-grained than SOA, and each microservice has an indipendent database layer. In this example, we have 2 microservices that are using the same database layer. So, isn't this going more towards SOA than real microservices, and what is the best approach? Thanks a lot for your great videos. Valentino
Excellent tutorial.
Easy to understand, you really deserve lot
Thanks
I am getting the below error in db-service., could you please help
2018-05-22 21:43:34.706 ERROR 9445 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool.
java.sql.SQLException: Unknown system variable 'tx_isolation'
Excellent tutorial
superb Tech Primers It's a very helpful video session thanks a lot to share this type of knowledge thanks again
Thanks Ramjeet
Awesome video!! Once the microservice architecture is created, how would I implement Swagger for documenting the API endpoints?
you can check my video on swagger with spring boot and use it in this
Can you provide the link to learn about zuul? I tried searching it , but not able to find it…
Hi , when I am converting DB service application as eureka client , every times it fails causing java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'. , hibernate session factory and related exception , whereas when i comment out the @Enable eureka client it starts working fine,
I added the dependencies as mentioned and also tried changing the version of the spring-boot dependency
I have followed your lecture carefully but not able to start the server and application. getting error
1.
Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
reason : Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
2. Failed to load ApplicationContext
3.Application run failed
Eu tenho 1 problema ao tentar logar mandar uma requisicao pro curso.
Eu ainda tomo erro 401 e debugando eu identifiquei que no setSecurityContext da class SecurityContextUtil.java, eu nao tenho JWTClaimsSet.
Nao sei onde pode ser o problema.
Na verdade eu tenho a ClaimSet, mas ela nao tem username. Eu so tenho iss, exp, userId, iat e authorities.
How in microservice architecture two services communicate each other ? and if any exception through one service which is dependent on other service how we will handle the exception ??
Hi Tech Primers, which component does the load balancing ? Service Registry or API Gateway ? thanks
It depends. Usually API Gateway does it in our case
In the delete endpoint, quotesRepository.delete(quotes) does not work for me but quotesRepository.deleteInBatch(quotes) worked
Same here!
Hi Tech Primers,
How would you secure your services ? Could you help me in understanding, what could be the good architecture to implement authentication and authorization in micro services, assuming application is both B2B and C2B.
Hi Ajay,
when I start the stock-service I get the following message and the application fails to start
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
For stock service we dont need to configure the database right? Request you to help me out here
your explanation and presentation are awesome.
YOu mentioned about the video on Eureka and Zuul. Kindly, provide the link. WIth google getting many other
Superb tutorial and presentation!
Thanks Channu. Glad that was useful
Getting exception on following line in delete method
@PostMapping("/delete/{username}")
public List delete(@PathVariable("username") final String userName){
List quotes = quoteRepository.findByUserName(userName);
quoteRepository.delete(quotes); // in CurdRepository cannot be applied.
return getQuotesByUserName(userName);
}
Let me know if i'm missing something
And I've not seen any delete(List obj) method in CurdRepository.
while making a video for developer main challenge is to solving exception, you should explain how to resolve those exception as well, in delete method how can we pass a list type object reference in List quotes = quotesRepository.findByUserName(username);
// quotesRepository.delete(quotes); this line I am getting error stating that this quotes should be Quotes type rather a list type, and I was commenting that piece of code and I am getting error while hit the url in postman getting this error, {
"timestamp": "2019-04-18T15:18:32.024+0000",
"status": 500,
"error": "Internal Server Error",
"message": "No message available",
"path": "/rest/db/add"
} Please help to resolve this
Let assume we have 30 microservices, so one instance of eureka server can not handle the all request. so we have to go for multiple instance of eureka server. my question is how to configure multiple instance of eureka server and how to register microservices with them?
Very nice and informative video. Keep it up
I think that application.yml is not working on this dependency.
I am expecting help. Thank you.
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
Hello my friend, i have a error in de DbServiceResource, line "quotesRepository.delete(quotes)", the sistem told me
"The method delete(Quote) in the type CrudRepository is not applicable for the arguments (List)"
What can be wrong with my code?
I fixed using "quotesRepository.deleteAll(quotes)", what can be he reason that the original code doesnt work for me
Hi this is very good video on Microservices can you please demo how we can deploy same project on container platforms like docker and kubernetes
Its returning 401 - unauthorised now with 3.13.0 and 3.12.3. Is there a way to fix this?
Hi Ajay
Great tutorial! Specifically learned about the usage of Zuul - Netflix's JVM based router and server side load balancer. Also learned about client-side service discovery using Spring Cloud Netflix Eureka. By the way, the music you play in the background is pretty cool. Sets the mood to write code :) Can you share the name of the music? ;) Thanks!
Thank you Tariq. Glad to hear that. :)
In this video the music is here: brokeforfree.bandcamp.com/track/day-bird
Most of videos are from Joakim Karud (you can search in soundcloud.com for his tracks)
Really nice video. I watched both of them and liked them as well. good information is filled in less time along with Architecture diagram. One of the best videos to learn Spring boot concepts.
-$
thanks sachin. Glad that was useful
Nice explanations, refreshed the concepts..
Hi,
Thanks for the hands on tutorial. Just one doubt. Don’t you think the database should associate with each micro services instead one common dB services for two micro services?
That's upto us. These are principles and standards. It makes sense when each microservices are managed by a different team.
If so then how will it be different then the monolithic architecture where all the services is referring single database. If we follow the one you are saying, it will be monolithic service sooner than later. Isn't it?
Hi I am trying to build Eureka service, facing error as "No bean found of type 'com.netflix.appinfo.ApplicationInfoManager' "
Class in Maven dependency is present.
Could you please help. Thanks
Where are running this program from? looks like the Netflix libraries are not getting downloaded to your system
@@TechPrimers facing error as "No bean found of type 'com.netflix.appinfo.ApplicationInfoManager' " . Netflix libraries are getting downloaded.
Hi, thanks for the video. A little help would be appreciated. My db-service works fine. when i run my stock-service, it doesn't startup saying it has some error getting CloudEurekaClient. I was wondering if you took some steps to setup Eureka, I understand that the Eureka server is not yet up and running and the stock-service should startup just fine but somehow my stock-service doesn't startup
Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException
some useful error messages
2018-01-19 18:54:00.414 INFO 682 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=21ae6e73,type=ConfigurationPropertiesRebinder]
2018-01-19 18:54:00.439 INFO 682 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2018-01-19 18:54:00.449 INFO 682 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2018-01-19 18:54:00.508 INFO 682 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2018-01-19 18:54:00.536 ERROR 682 --- [ main] o.s.c.n.e.s.EurekaRegistration : error getting CloudEurekaClient
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient!
HI Kaus, No additional setup is required for Eureka to be UP. just check if your ports are not blocked by other processes?
Can you explain how to secure microservices with jwt and/or oauth2?
sure. will do kenny
hello thanks for tutorial. If we put eureka and zuul in the same microservices, how to prevent client access to localhost:8003/eureka dashboard. because we need to open this api to world wide web. now everyone can see our service registiry right?
Hi, please give the link to the video you mentioned "What is zuul" and "What is Eureka"
Please add 3rd episode of microservices video with hystrix and logging that will very helpful Mr. Champion behind tech primer
Sure nithin. Will do
Very interesting video as it shows consequently how the practive works very good. Is the source code for download somewhere?
Yes it's in the GitHub link in the description
Nice video tutorial but want to know how to implement spring security in microservice architecture? Can you please make video tutorial for that?
Hi, I am facing below error, while bringing up stock-service, please help
org.springframework.context.ApplicationContextException: Failed to start bean 'eurekaAutoServiceRegistration'; nested exception is java.lang.NullPointerException
why do we need to register db service instance too as a client ? because anwway we are gonna access via stock price service right. Is there any specific purpose behind this registration?
+surendirababu janarthanan Yes. We don't have to hard code URL of Db service in stock service, hence we register db service to Eureka and access it from there. If DB service is deployed in different port, we don't have to do a code change in stock service. Hence this architecture pattern is followed
Good tutorial but remove background noise. Thanks a lot , that I understood basics of ms . Please upload next videos
Hi Tech Primer, let me complement you first by saying "both the videos you posted on Micro services were simply superb". I am an AWS Architect who is learning Spring Boot from your lectures. Can you help me in resolving few questions on a complex AWS architecture diagram? I am looking forward to integrating AWS API-Gateway REST services with Spring Boot.
these urls are more restful: get /rest/deb/quotes, post /rest/db/quotes, delete /rest/db/quotes/{id}
Whats your opinion on using netflix oss vs istio Envoy when it come to deploy this application on k8s ?
Hi please share URL for zuul and eureka as you mentioned in this video.
Hey man, Thanks for the tutorial, very informative!!
I am getting this error it is not getting auto wired
Parameter 0 of constructor in com.learnspring.stock.dbservice.resource.DbServiceResource required a bean of type 'com.learnspring.stock.dbservice.repository.QuoteRepository' that could not be found
the repository is not getting scanned by Spring Boot. Check if you have @EnableJpaRepositories annotation
Ajay, too good..Keep posting:)
Thank you Pritam. Glad that was useful!
Hi.. Can u pls add new video for adding throttling in Spring Cloud services solution project.
You setup database connection properties but where is the MySql database? Is it been created automatically. If it is created automatically but I got some errors like:
Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at com.subaratabio.dbservice.DbServiceApplication.main(DbServiceApplication.java:12) [classes/:na]
Yes Subrata, the tables are created automatically when you have auto-dll as 'update'. can you provide the code which you are using (you can upload the project to GitHub). Also you check my example from the Github link in the description
Thanks bro for instant replay, for the sake of better understand, I uploaded my code into Github. Please kindly check it and help me for further process.
github.com/Subarata-Talukder/Spring-Microservice
The issue is due to Autowiring problem in DbServerService.java.
github.com/Subarata-Talukder/Spring-Microservice/blob/master/db-service/src/main/java/dbresource/DbServerService.java
Add Constructor Injection or @Autowire for the QuotesRepo variable.
After applying your suggestion but it is returning errors like. Could you explain it (One thing I forgot to inform you, I am developing this project on Ubuntu Linux based Machine)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE]
at com.subaratabio.dbservice.DbServiceApplication.main(DbServiceApplication.java:12) [classes/:na]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359) ~[spring-orm-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE]
... 16 common frames omitted
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Unable to open JDBC connection for schema management target
at org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:42) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:57) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:134) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
... 22 common frames omitted
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:341) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2192) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2225) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2024) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.42.jar:5.1.42]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_144]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_144]org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.tool.schema.internal.TargetDatabaseImpl.prepare(TargetDatabaseImpl.java:38) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
... 28 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~
............
The @EnableJpaRepositories has incorrect package name. You have to put the package of the QuotesRepo. which is "reporesource". Change that.
The error says its not able to load the Quote entity into the Repo since its not able to identify it as a jparepository
background sound is disturbing too much. good tutorial
I've imported the Maven project and launched the Eureka service then the DB service.
1. Launching the Eureka service is a success.
2. Launching the DB service is a success (I've modified the application.properties to connect to my MySQL database).
However, after I launch the DB service, the Eureka service keeps throwing exception:
ERROR 3146 --- [et_localhost-17] c.n.e.cluster.ReplicationTaskProcessor : Network level connection to peer localhost; retrying after delay
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused
localhost:8302 gives me:
Application: DB-SERVICE
AMIs: n/a (1)
Available Zones: (1)
Status: UP (1) - 192.168.1.4:db-service:8300
EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.
Fixed it by changing port of the Eureka service from 8302 to 8761 (default).
What is the advantage of having db-service.? We can create a seperate project for data jpa (entities, repositories) and add dependency in micro services. Right? Please let me know
that way our DB and its relevant microservice is separate. else, if there is a Table change, you need to update all microservices to use the new dependency verison.
Tech Primers thanks for the clarification
Great channel! very use full
Can you please give the next video's link?
Thank you very much.Please make a video on Docker.
hi Anil, you can check my video on Docker with Spring Boot.
Hello ,
How do I deploy this in External SSL enabled tomcat ?