Error creating bean with name 'jwtDecoderByJwkKeySetUri' defined in class path resource - java

I am having this error while trying to run the ResourceServer, it complains about the: http://localhost:8080/auth/realms/xxxnapp/protocol/openid-connect/certs as it has no protocol
Error creating bean with name 'jwtDecoderByJwkKeySetUri' defined in
class path resource
[org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration$JwtDecoderConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.springframework.security.oauth2.jwt.JwtDecoder]:
Factory method 'jwtDecoderByJwkKeySetUri' threw exception; nested
exception is java.lang.IllegalArgumentException: Invalid JWK Set URL
"=
http://localhost:8080/auth/realms/xxxnapp/protocol/openid-connect/certs"
: no protocol: =
http://localhost:8080/auth/realms/xxxnapp/protocol/openid-connect/certs
any idea how I over come this error.

there is an additional "=" before the url in the proprieties file which is causing the error. by modifying it I have my program running.

Related

Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException:

It's an error that comes out during spring build. I changed the difference from the existing source code to mariaDB -> mysqlDB. I wonder why this error is coming out.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot configure enpdoints
Caused by: java.lang.IllegalStateException: Cannot configure enpdoints
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStore' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
I translate your question into two part.
BeanInstantiationException
This exception thrown when instantiation of a bean failed. Carries the offending bean class. more specifically IOC experienced error on creating bean with name 'jwtAccessTokenConverter' defined in class path resource [.../springbootstudy/config/oauth/AuthorizationServer.class.
JwtAccessTokenConverter
It translates between JWT encoded token values and OAuth authentication information (in both directions). Also acts as a TokenEnhancer when tokens are granted.Furthermore log translator suggest that string argument (please read the field sumery) with in jwtAccessTokenConverter must have text; it must not be null, empty, or blank. this may cause by miss configuration but more debugging details required for this.

org.drools.template.parser.DecisionTableParseException: Failed to open Excel stream, please check that the content is xls97 format

I have created a new excel file which was in .XSLX format (autosaved). I reopened it and saved as ".XLS", but I still get this error in running my Spring Boot app.
Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'droolsDemoController': Unsatisfied
dependency expressed through field 'session'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'getKieSession' defined in class path resource
[com/svc/config/DroolsDemoConfig.class]: Bean instantiation via
factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.kie.api.runtime.KieSession]: Factory method
'getKieSession' threw exception; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'getKieContainer' defined in class path
resource [com/svc/config/DroolsDemoConfig.class]: Bean instantiation
via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.kie.api.runtime.KieContainer]: Factory method
'getKieContainer' threw exception; nested exception is
org.drools.template.parser.DecisionTableParseException:
[accountEligibility1.xls] Failed to open Excel stream, please check
that the content is xls97 format.
I am successfully able to open the file using Excel, it's not corrupted. I am not sure how to fix this error.
The excel file is in /resources folder and is being able to located accurately at startup time.

Disable #SqsListener for local environment

I have the following value configured in my SQS Listener in springboot. The queue is configured only for DEV and STAGE environments. So I want to disable it in my local after testing. How do i achieve that?
#SqsListener(value = { "${cloud.aws.endpoint}" } , deletionPolicy =SqsMessageDeletionPolicy.ON_SUCCESS)
public void processMessage(String message) throws Exception {
}
I tried to add the following to my application-local.xml(to keep it local), but it didn't work. Anyone went through the same scenario?
autoconfigure:
exclude:
- org.springframework.cloud.aws.autoconfigure.messaging.MessagingAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration
- org.springframework.cloud.aws.autoconfigure.context.ContextRegionProviderAutoConfiguration
I am getting the following error everytime.
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stackResourceRegistryFactoryBean' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration.class]: Unsatisfied dependency expressed through method 'stackResourceRegistryFactoryBean' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autoDetectingStackNameProvider' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackNameProvider]: Factory method 'autoDetectingStackNameProvider' threw exception; nested exception is java.lang.IllegalArgumentException: No valid instance id defined
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:799) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
com.amazonaws.SdkClientException: Failed to connect to service endpoint:
at com.amazonaws.internal.EC2ResourceFetcher.doReadResource(EC2ResourceFetcher.java:100) [aws-java-sdk-core-1.11.867.jar:na]
Caused by: java.net.ConnectException: Host is down (connect failed)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autoDetectingStackNameProvider' defined in class path resource [org/springframework/cloud/aws/autoconfigure/context/ContextStackAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.env.stack.config.StackNameProvider]: Factory method 'autoDetectingStackNameProvider' threw exception; nested exception is java.lang.IllegalArgumentException: No valid instance id defined
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657) ~[spring-beans-5.2.12.RELEASE.jar:5.2.12.RELEASE]
at org.sprin
I've faced similar issues while using #SqsListener. What I usually do is comment out the annotation when running the app locally - it's ugly but it works.

#RepositoryRestResource did not work Spring boot 2.2.1.RELEASE. while running occured error RegionRepository must only contain a single path segment

#RepositoryRestResource(path = "/region", collectionResourceRel = "list", excerptProjection = CustomRegion.class)
public interface RegionRepository extends JpaRepository<Region, Integer> {
}
data rest class
#SpringBootApplication
public class ProfUzApplication {
public static void main(String[] args) {
SpringApplication.run(ProfUzApplication.class, args);
}
}
main running class
Occured error
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'repositorySearchController' defined in URL [jar:file:/C:/Users/saidk/.m2/repository/org/springframework/data/spring-data-rest-webmvc/3.2.1.RELEASE/spring-data-rest-webmvc-3.2.1.RELEASE.jar!/org/springframework/data/rest/webmvc/RepositorySearchController.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityLinks' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.webmvc.support.RepositoryEntityLinks]: Factory method 'entityLinks' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceMappings' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.mapping.RepositoryResourceMappings]: Factory method 'resourceMappings' threw exception; nested exception is java.lang.IllegalStateException: Path /region configured for uz.pdp.prof.repository.RegionRepository must only contain a single path segment!
You have to mention path='endpoint name' without using '/' in #RepositoryRestResource. You have to use #RepositoryRestResource(path = "region"), it's direct spring MVC to create RESTful endpoints at /region
The problem is happening because you defined the path using "/". Spring does not allow us to define a composed path like "/api/v1/my_entity". Just remove the "/" from your path and it will work.
I created a new project based on 2.2.2 a couple days ago and got the same issue.
After a few tries, the way to fix it is to use the same value in path and collectionResourceRel. In your case, try to use "region" in both path and collectionResourceRel.

graphql java - How to find out the root cause of "Invalid schema provided"?

How to find out the root cause of "Invalid schema provided"? I have many *.graphqls. Some of them just have data type IDL without any query and mutation definition.
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'schemaParser' defined in class path resource
[com/oembedler/moon/graphql/boot/GraphQLJavaToolsAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.coxautodev.graphql.tools.SchemaParser]: Factory
method 'schemaParser' threw exception; nested exception is
com.coxautodev.graphql.tools.InvalidSchemaError: Invalid schema
provided (org.antlr.v4.runtime.InputMismatchException) at:
[#313,1904:1904='[',<11>,120:12]

Categories