Posts

React Js : Text response is empty when using fetch

 Today i faced the below issue when learning react Js , Im documenting it here so that it will help people like me. I was trying to do a Rest APi request to backend server using fetch like below : fetch ( url ,{ method : 'GET', mode: 'no-cors' }) . then (( res ) => { return res . text (); }) . then (( data ) => {                    console.log(data); setIsAuth ( data ); }) . catch (( error ) => console . error ( "Error:" , error )); When i execute it backend server was returning a valid response but on the cosole it was displaying blank. Upon research i found that : i have to Remove  mode: 'no-cors' . When you use  no-cors  mode, you’re explicitly specifying that you want an  “opaque response” . Your script can’t access any properties of an opa...

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()'] with root cause java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()'

Image
Today i faced a weird exception where in my spring boot app was throwing the below error : 2024-09-04T20:01:07.764-07:00 ERROR 2713 --- [xplore] [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()'] with root cause java.lang.NoSuchMethodError: 'boolean org.springframework.web.context.request.async.WebAsyncManager.isMultipartRequestParsed()' at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1125) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979) ~[spring-webmvc-6.1.12.jar:6.1.12] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014) ~[spring-webmvc-6.1.12.jar:6.1.1...

JPA Connect to multiple datasources

  Spring JPA Connect to multiple datasources : Follow below steps if you are using Spring JPA and have multiple data sources. In the application.properties file or application.yml file have the below properties :   server.port: 8080 spring:   datasource:     url: jdbc:sqlserver://localhost:1433;databaseName=name;authenticationScheme=NTLM;integratedSecurity=true     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver     username: ${database.username.ms}     password: ${database.password.ms}   datasource-secondary:     url: jdbc:postgresql://localhost:5432/dbname     username: ${database.username}     password: ${database.password}     driver-class-name: org.postgresql.Driver   jpa:     hibernate:       ddl-auto: update If you see in the above properties I’m using spring.datasource as primary data source and spring.datasource-secondary as the ...