beancreationexception : error creating bean with name downloadcontroller : lookup - spring

beancreationexception : error creating bean with name downloadcontroller : lookup
I don't have idea why that error coming can someone pls help me .

Related

How to resolve FatalBeanException in Spring?

I get the following exception:
org.springframework.beans.FatalBeanException: Context hybris Global Context Factory couldn't be created correctly due to, Error creating bean with name 'modifyPopulatorList$child#0' defined in class path resource [config/cmsfacades-cmsitems-spring.xml]: Initialization of bean failed;
Error creating bean with name 'ordermanagementOrderConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderPopulator' while setting bean property 'populators' with key [0];
Error creating bean with name 'ordermanagementOrderPopulator' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderEntryConverter' while setting bean property 'orderEntryConverter';
Error creating bean with name 'ordermanagementOrderEntryConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderEntryPopulator' while setting bean property 'populators' with key [0];
Error creating bean with name 'warehousingOrderEntryPopulator' defined in class path resource [warehousingfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementProductConverter' while setting bean property 'productConverter';
Error creating bean with name 'ordermanagementProductConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementProductPopulator' while setting bean property 'populators' with key [0];
Error creating bean with name 'ordermanagementProductPopulator' defined in class path resource [ordermanagementfacades-spring.xml]: Error setting property values;
Invalid property 'designerConverter' of bean class [de.hybris.platform.ordermanagementfacades.product.converters.populator.OrdermanagementProductBasicPopulator]: Bean property 'designerConverter' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
This is my bean registration :
<alias name="defaultCustomProductBasicPopulator" alias="productBasicPopulator"/>
<bean id="defaultCustomProductBasicPopulator" parent="defaultProductBasicPopulator"
class="de.hybris.NagAcc.facades.product.converters.populator.CustomProductBasicPopulator">
<property name="designerConverter" ref="designerConverter" />
</bean>
This is the class :
public class CustomProductBasicPopulator<SOURCE extends ProductModel, TARGET extends ProductData> extends ProductBasicPopulator<SOURCE,TARGET> {
private Converter<DesignerModel,DesignerData> designerConverter;
public Converter<DesignerModel, DesignerData> getDesignerConverter() {
return designerConverter;
}
public void setDesignerConverter(Converter<DesignerModel, DesignerData> designerConverter) {
this.designerConverter = designerConverter;
}
#Override
public void populate(SOURCE productModel, TARGET productData) throws ConversionException {
super.populate(productModel, productData);
if (productModel.getDesigner() != null)
{
DesignerData designerData = getDesignerConverter().convert(productModel.getDesigner());
productData.setDesigner(designerData);
}
}
This is the parent bean definition :
<alias name="defaultProductBasicPopulator" alias="productBasicPopulator"/>
<bean id="defaultProductBasicPopulator" parent="baseProductPopulator"
class="de.hybris.platform.commercefacades.product.converters.populator.ProductBasicPopulator">
<property name="productConfigurableChecker" ref="productConfigurableChecker"/>
</bean>
The complete stack trace:
org.springframework.beans.FatalBeanException: Context hybris Global Context Factory couldn't be created correctly due to, Error creating bean with name 'modifyPopulatorList$child#0' defined in class path resource [config/cmsfacades-cmsitems-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordermanagementOrderConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderPopulator' while setting bean property 'populators' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordermanagementOrderPopulator' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderEntryConverter' while setting bean property 'orderEntryConverter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordermanagementOrderEntryConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementOrderEntryPopulator' while setting bean property 'populators' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'warehousingOrderEntryPopulator' defined in class path resource [warehousingfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementProductConverter' while setting bean property 'productConverter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordermanagementProductConverter' defined in class path resource [ordermanagementfacades-spring.xml]: Cannot resolve reference to bean 'ordermanagementProductPopulator' while setting bean property 'populators' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ordermanagementProductPopulator' defined in class path resource [ordermanagementfacades-spring.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'designerConverter' of bean class [de.hybris.platform.ordermanagementfacades.product.converters.populator.OrdermanagementProductBasicPopulator]: Bean property 'designerConverter' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at de.hybris.platform.core.HybrisContextFactory.build(HybrisContextFactory.java:307)
at de.hybris.platform.core.HybrisContextFactory$GlobalContextFactory.buildSelf(HybrisContextFactory.java:179)
at de.hybris.platform.core.HybrisContextFactory$GlobalContextFactory.build(HybrisContextFactory.java:165)
at de.hybris.platform.core.HybrisContextHolder.getGlobalInstanceCached(HybrisContextHolder.java:122)
at de.hybris.platform.core.HybrisContextHolder.getGlobalInstance(HybrisContextHolder.java:101)
at de.hybris.platform.core.HybrisContextHolder.getAppCtxFactory(HybrisContextHolder.java:152)
at de.hybris.platform.core.HybrisContextHolder.getApplicationInstance(HybrisContextHolder.java:78)
at de.hybris.platform.core.AbstractTenant.createCoreApplicationContext(AbstractTenant.java:758)
at de.hybris.platform.core.AbstractTenant.doStartupSafe(AbstractTenant.java:799)
... 22 more
According to me all getters and setters are fine, I can not resolve this error. Please help.
I don't have access to hybris sources to have a look (thank god!), but I think it's worth to have a look at the Javadoc of OrdermanagementProductBasicPopulator:
public void populate​(ProductModel productModel, ProductData productData)
Description copied from interface: Populator
Populate the target instance with values from the source instance.
Overrides:
populate in class ProductBasicPopulator
So I guess, the class OrdermanagementProductBasicPopulator extends ProductBasicPopulator but the bean definition of OrdermanagementProductBasicPopulator has your productBasicPopulator as a parent, which means that spring tries to inject the property of your bean definition, which is not a property in the inheritance chain of OrdermanagementProductBasicPopulator.
As mentioned, this is just a guess because I don't see the sources...
If my guess is correct, it depends on your requirements how to get rid of this problem. You can either give your bean a new alias and modify the populator list(s) where necessary or you override the bean alias of OrdermanagementProductBasicPopulator accordingly.
If thats's not the problem, please post the bean definition of OrdermanagementProductBasicPopulator.

Why creating been in Spring occurs with error?

Hello I am creating program which will communicate and send information using channel. When I run program it doesn't work.
Errors:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-05-02 13:47:37.938 ERROR 12584 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloWorldQueueProducer' defined in file [C:\workspace\target\classes\edu\producer\HelloWorldQueueProducer.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jmsTemplate' defined in class path resource [org/springframework/boot/autoconfigure/jms/JmsAutoConfiguration$JmsTemplateConfiguration.class]: Unsatisfied dependency expressed through method 'jmsTemplate' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConnectionFactory' defined in class path resource [org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryConfiguration$SimpleConnectionFactoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.jms.connection.CachingConnectionFactory]: Factory method 'cachingJmsConnectionFactory' threw exception; nested exception is java.lang.IllegalStateException: Unable to create ActiveMQConnectionFactory
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) ~[spring-beans-5.3.5.jar:5.3.5]
#Component
#RequiredArgsConstructor
public class HelloWorldQueueProducer {
private final JmsTemplate jmsTemplate;
#Scheduled(fixedRate = 2000)
public void sendHello() {
HelloMessage message = HelloMessage.builder()
.id(HelloMessage.nextId())
.createdAt(LocalDateTime.now())
.message("Hello world!")
.build();
jmsTemplate.convertAndSend(JmsConfig.QUEUE_HELLO_WORLD, message);
System.out.println("HelloWorldQueueProducer.sendHello - sent message: " + message);
}
}
Not quite sure about it, but have you defined the necessary properties in your application.properties? You need to set them like this i. e.
spring.artemis.mode=native
spring.artemis.host=localhost
spring.artemis.port=61616
spring.artemis.user=developer
spring.artemis.password=developer
jms.queue.destination=myqueue
Otherwise the autoconfiguration of spring boot wouldn't bootstrap the necessary beans. I had this problem once.

Reading environment variables or properties in a file

I am trying to deploy a spring-boot 2.0.4 application. The configuration looks like below :
#Component
#Configuration
#PropertySource("classpath:elast.properties")
public class ElastSearchLogLevel {
private static final Logger LOG = LoggerFactory.getLogger(ElastSearchLogLevel.class);
#Value("${elast.mail.to}")
private String to;
...
Locally on windows its working fine but in Linux box it says :
WARN o.a.commons.logging.impl.Jdk14Logger.log - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'elastSearchBootApplication': Unsatisfied dependency expressed through field 'logsSearch'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elastSearchLogLevel': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'elast.mail.to' in value "${elast.mail.to}"
The instance 'elastSearchLogLevel' is autowired in SpringBootApplication class. Ideally i want to give an external configuration file from which the property can be read. As suggested in one of the forum I also tried but didn't work.
#PropertySource("classpath:file:///my/file/path/elast.properties")
ok some more code :
#ComponentScan(basePackages = "some.packer.log")
#SpringBootApplication
#EnableScheduling
public class ElastSearchBootApplication {
...

Springboot Oauth2 : org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator$UnauthorizedException

I am trying to implement a fully functional Spring-boot oauth2. I manage to implement a login with success credential, I get the proper response with access_token and refresh_token, using /oauth/token
Using correct username and password
{
"access_token": "b8c45984-c573-4837-9ef6-6896f308a286",
"token_type": "bearer",
"refresh_token": "48145463-830e-4467-ab89-587bda6b32de",
"expires_in": 43199,
"scope": "read write"
}
and if i use a wrong username it give me a proper error, which i am happy about;
Wrong Username:
{error: "unauthorized", error_description: "No value present"}
error
:
"unauthorized"
error_description
:
"No value present"
but the problem comes when i use correct username and incorrect password; i get the below error
2018-05-28 14:47:25.264 WARN 6604 --- [nio-8088-exec-2] .c.j.MappingJackson2HttpMessageConverter :
Failed to evaluate Jackson serialization for type [class org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator$UnauthorizedException]:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.common.exceptions.OAuth2ExceptionJackson2Serializer':
BeanPostProcessor before instantiation of bean failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource
[org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]:
Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]:
Factory method 'transactionAdvisor' threw exception;
nested exception is java.lang.NullPointerException

Grails: Error creating bean with name 'properties': Bean definition is abstract

I'm new to Grails so I posted a question a few days ago on how to do a query to a different Datasource:
Grails - Getting data from a different datasource and saving it in my Grails database
The answer above worked, but then I got a strange error when I tried to view or modify anything in my default datasource. In this case I tried to go to index view of my Client controller which uses some basic scaffolding:
[http-bio-8080-exec-10] ERROR spring.ReloadAwareAutowireCapableBeanFactory - Bean couldn't be autowired using grails optimization: Error creating bean with name 'properties': Bean definition is abstract
[http-bio-8080-exec-10] ERROR spring.ReloadAwareAutowireCapableBeanFactory - Retrying using spring autowire
[http-bio-8080-exec-10] ERROR errors.GrailsExceptionResolver - BeanIsAbstractException occurred when processing request: [GET] /EmmaRestServer/client/index
Error creating bean with name 'properties': Bean definition is abstract. Stacktrace follows:
Message: Error creating bean with name 'properties': Bean definition is abstract
If I remove the second datasource, this problem disappears. What could be causing this issue?
I had some extra configurations in the resources.groovy. I removed them and now it looks like this, and it works properly:
beans = {
dataSource_drupal(DataSource) { bean ->
bean.destroyMethod = 'close'
driverClassName = "com.mysql.jdbc.Driver"
username = "user"
password = "password"
url = "jdbc:databaseURL
}
}

Resources