Friday, August 8, 2025

WebFlux CORS error

 Hi:

I tried to use Spring Web Gateway Configuration and the follow problem occur using Spring Webflux:

-----------------------

"from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed", spring cloud gateway

----------------------

The solution was to use predicates of Spring Webflux instead:

-------------------

server:

  port: 7002

eureka:

  instance:

   hostname: localhost

  client:

    register-with-eureka: true

    fetch-registry: true

    service-url:

      defaultZone: http://localhost:8761/eureka/

spring:

  application:

    name: server-gateway

  cloud: 

    gateway:

      server:

        webflux:

          routes:

          - id : service-envio

            uri: lb://abc

            predicates:

            - Path=/senvios/**

            filters:

            - RewritePath=/senvios/*, /

          default-filters:

          - DedupeResponseHeader=Access-Control-Allow-Origin Access-Control-Allow-Credentials, RETAIN_UNIQUE

          globalcors:

            cors-configurations:

              '[/**]':

                allowedorigins: "*"

                allowedmethods: "*"

                allowedheaders: "*"

                allowed-credentials: true 

-------------------


Best Regards,

Friday, July 25, 2025

Error of Shared classes at Junit Test

 After upgrade of JDK, I was using JDK-17  and in JUnit Test an error appear with the following description:

Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

The solution to this warning was to add a flag as an argument in STS/Eclipse at VM arguments in JUnit Test, the flag is the following below:

-Xshare:off

Best regards,

Thursday, October 31, 2024

Keycloak authentication error - Account is not fully set up

 After creating a user a given all permissions and roles, I am facing the following problem with a client:

{
    "error": "invalid_grant",
    "error_description": "Account is not fully set up"
}

I am using 26.0.4 Keycloak version, so I decided to create a new user this time with name and password and Email approved in on status, now I can log in without problems.

Best Regards,