HybrisContextFactory-初始化全局应用程序上下文时出错 [英] HybrisContextFactory - Error initializing global application context

查看:76
本文介绍了HybrisContextFactory-初始化全局应用程序上下文时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将我的应用程序版本从Hybris 4.8迁移到Hybris 5.6.0.5.

I try to migrate the version of my application from Hybris 4.8 to Hybris 5.6.0.5.

服务器启动时,我遇到以下异常:

When the server starts I have this exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'csTicketFacade' defined in class path resource [CoopAcceleratorFrontEndfacades-spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class  [com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade]: Constructor threw exception; nested exception is java.lang.NullPointerException

INFO   | jvm 1    | main    | 2016/01/20 11:41:54.777 | Caused by: java.lang.NullPointerException
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.790 |     at com.accenture.facades.common.FlexSelector.getPropertiesReader(FlexSelector.java:27)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.797 |     at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade$TicketFlexSelector.getCsAgentGroupUID(CoopCSTicketFacade.java:68)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.805 |     at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade$TicketFlexSelector.getCsAgentGroupModel(CoopCSTicketFacade.java:31)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.809 |     at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade.<init>(CoopCSTicketFacade.java:80)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.820 |     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.823 |     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.828 |     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.834 |     at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.838 |     at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
INFO   | jvm 1    | main    | 2016/01/20 11:41:54.843 |     ... 35 more

因为在FlexSelector类中:

Because in the class FlexSelector:

protected static final ApplicationContext ctx = Registry.getApplicationContext();

spring的应用程序上下文为null. 如果有人有任何想法,请告诉我.

The application context of spring is null. If someone has any idea please tell me.

推荐答案

您真的只需要applicationContext对象吗?如果您只需要检索Bean,则可以按照以下步骤进行操作:

Do you really need just the applicationContext object ? If you just need to retrieve the bean you could do it like below:

最终的ManagerFactoryBean managerFactoryBean =(ManagerFactoryBean)Registry.getApplicationContext().getBean("managerFactoryBean");

final ManagerFactoryBean managerFactoryBean = (ManagerFactoryBean) Registry.getApplicationContext().getBean("managerFactoryBean");

我也从事混合工作,这就是我获得bean引用的方式.

I too work in hybris and this is how I get my bean references.

这篇关于HybrisContextFactory-初始化全局应用程序上下文时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆