Integrating rqueue with spring boot application - java

Error creating bean with name 'rqueueConfig' defined in class path resource [com/github/sonus21/rqueue/spring/boot/RqueueListenerAutoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.github.sonus21.rqueue.config.RqueueConfig]: Factory method 'rqueueConfig' threw exception; nested exception is java.lang.UnsupportedOperationException: Scripting commands not supported in pipelining/transaction mode
Followed steps mentioned on the website, https://github.com/sonus21/rqueue
There, it was mnentioned #EnableRqueue annotation, but it gave me a error, that it cannot find the annotation.
I am using JAVA 11 and spring boot framework.

Related

Error creating bean with name 'defaultServletHandlerMapping' defined in class path resource

I am getting below error after updating spring-boot starter parent to 2.4.3. But after setting up server.servlet.register-default-servlet=true application is working as expected. But one i would like to know is, in the reference spring documentation >Spring Boot 2.4 will no longer register the DefaultServlet provided by your servlet container. In most applications, it isn’t used since the Spring MVC’s DispatcherServlet is the only servlet that’s required.
So do i missing anything as my application is not considering DispatcherServlet as default one
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultServletHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'defaultServletHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: Unable to locate the default servlet for serving static content. Please set the 'defaultServletName' property explicitly.
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)

Spring boot is picking wrong CorsFilter

I am working on a spring boot web application with security features. I am relying on a library with a custom Cors Filter that I need to use but my application keeps picking the Spring Web Framework Cors Filter instead and renders the following error:
[ERROR] Failed to execute goal
org.springframework.boot:spring-boot-maven-plugin:2.0.5.RELEASE:run
(default-cli) on project tools-services: An exception occurred while
running. null: InvocationTargetException: Error creating bean with
name 'springSecurityFilterChain' defined in class path resource
[org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.servlet.Filter]: Factory method
'springSecurityFilterChain' threw exception; nested exception is
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean
named 'corsFilter' is expected to be of type
'org.springframework.web.filter.CorsFilter' but was actually of type
'com.myproj.sample.inf.sec.filter.CorsFilter' -> [Help 1]
I am trying to create a CorsFilter bean in my Application.java class as such:
#Bean
public CorsFilter corsFilter() {
return new CorsFilter();
}
However, this gives me the same error. Is there a way to make Spring Boot point to the custom cors filter or disable the spring cors filter?
Probably is because of the same name. Can you try to change bean name used in your Application.java?

Spring boot ManagedExecutorService instance

We are creating a new Spring Boot project and a part of it needs multi-threading operation. We are trying to use the ManagedExecutorService, so we declared it as follows:
#Resource(name="java:comp/DefaultManagedExecutorService")
private ManagedExecutorService mes;
And during execution returned the error:
Injection of resource dependencies failed; nested exception is
org.springframework.beans.factory.BeanDefinitionStoreException:
Invalid bean definition with name 'java:comp/DefaultManagedExecutorService' defined in JNDI environment: JNDI lookup failed; nested exception is
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
Does this means that Spring Boot does not support/allow us to use the ManagedExecutorService in tomcat?

I have been using cxf 3.0.16 version jar for rest service use, but after migrating to 3.2.4. Its getting error while service bean creation

I have been using cxf 3.0.16 version jar for rest service use, but after migrating to 3.2.4. It's getting error while service bean creation.
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.IllegalArgumentException: Invalid media type string: /application/json
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:121)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)

How do I properly configure Spring OAuth 2 for Web UI log in?

I have the OAuth 2 configuration working properly, and I'm currently in the process of enabling Web UI as well. Since the configuration involves Web security, I already have part of it set up. Actually, my understanding is that I don't really have much more to add anymore, other than the MVC components (like the login page, URL mappings, etc.) However, I'm having trouble logging into the Web app since the user is being tagged as anonymousUser.
Both WebSecurityConfigurerAdapter and ResourceServerConfigurerAdapter define method configure(HttpSecurity). Currently, I'm using the one defined in ResourceServerConfigurerAdapter but that's where I'm experiencing the User being tagged as anonymous. If I try using the one in WebSecurityConfigurerAdapter (with OAuth 2 currently configured), I get the following error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: Cannot apply org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer#546ed2a0 to already built object
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
...
Caused by:
Caused by: java.lang.IllegalStateException: Cannot apply org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer#546ed2a0 to already built object
at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.add(AbstractConfiguredSecurityBuilder.java:196) ~[spring-security-config-4.1.3.RELEASE.jar:4.1.3.RELEASE]
...
However, when I disable everything related to the OAuth 2, and only use WebSecurityConfigurerAdapter (with HttpSecurity set up), login via the Web UI works as expected (i.e. user is not tagged as anonymous). I'm not sure what key area I got wrong on this.

Categories

Resources