cancel
Showing results for 
Search instead for 
Did you mean: 

Error initializing global application context!

Former Member
0 Kudos

HI all, I have an exception when try to start server tomcat: enter code hereERROR [localhost-startStop-1] [HybrisContextFactory] Error initializing global application context! 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 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1037) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:983) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at de.hybris.platform.core.HybrisContextFactory.refreshContext(HybrisContextFactory.java:98) at de.hybris.platform.core.HybrisContextFactory$ApplicationContextFactory.build(HybrisContextFactory.java:266) at de.hybris.platform.core.HybrisContextHolder.getApplicationInstance(HybrisContextHolder.java:90) at de.hybris.platform.core.AbstractTenant.createCoreApplicationContext(AbstractTenant.java:667) at de.hybris.platform.core.AbstractTenant.doStartupSafe(AbstractTenant.java:701) at de.hybris.platform.core.AbstractTenant.doStartUp(AbstractTenant.java:650) at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:566) at de.hybris.platform.core.Registry.activateTenant(Registry.java:627) at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:471) at de.hybris.platform.core.Registry.activateMasterTenant(Registry.java:534) at de.hybris.platform.core.Registry.startup(Registry.java:420) at de.hybris.platform.spring.HybrisContextLoaderListener.startRegistry(HybrisContextLoaderListener.java:178) at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:77) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4992) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: 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 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1030) ... 33 more Caused by: java.lang.NullPointerException at com.accenture.facades.common.FlexSelector.getPropertiesReader(FlexSelector.java:29) at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade$TicketFlexSelector.getCsAgentGroupUID(CoopCSTicketFacade.java:68) at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade$TicketFlexSelector.getCsAgentGroupModel(CoopCSTicketFacade.java:31) at com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade.(CoopCSTicketFacade.java:80) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) ... 35 more

In this java class:

 package com.accenture.facades.common;
 
 import java.util.List;
 
 import org.springframework.context.ApplicationContext;
 
 import com.accenture.hybris.core.PropertiesReader;
 import com.accenture.hybris.facades.converters.CoopProductConverter;
 
 import de.hybris.platform.catalog.CatalogVersionService;
 import de.hybris.platform.core.Registry;
 import de.hybris.platform.product.ProductService;
 import de.hybris.platform.search.restriction.SearchRestrictionService;
 import de.hybris.platform.servicelayer.i18n.CommonI18NService;
 import de.hybris.platform.servicelayer.model.ModelService;
 import de.hybris.platform.servicelayer.search.FlexibleSearchService;
 import de.hybris.platform.voucher.VoucherService;
 
 public class FlexSelector{
     
 
     //protected static final ApplicationContext ctx = Registry.getApplicationContext();
     
     protected static final String CATALOG_ID = "coop.catalog.runtime.name";
     protected static final String CATALOG_VERSION = "coop.catalog.runtime.version";
     protected static final String CURRENCY_ISOCODE = "coop.catalog.runtime.currency.isocode";
     
     protected static final PropertiesReader getPropertiesReader(){
     return (PropertiesReader) Registry.getApplicationContext().getBean("propertiesReader");
     }
 
     protected static final SearchRestrictionService getSearchRestrictionService(){
     return (SearchRestrictionService) Registry.getApplicationContext().getBean("searchRestrictionService");
     }
     
     protected static final CoopProductConverter getConverter(){
     return (CoopProductConverter) Registry.getApplicationContext().getBean("productConverter");
     }
     
 //    protected static final ApplicationContext getApplicationContext(){
 //    return ctx;
 //    }
 
     protected static final <T> T getModelByExample(T example) {
     return getFlexibleSearchService().getModelByExample(example);
     }
 
     protected static final <T> List<T> getModelsByExample(T example) {
     return getFlexibleSearchService().getModelsByExample(example);
     }
     
     protected static final FlexibleSearchService getFlexibleSearchService(){
     return (FlexibleSearchService) Registry.getApplicationContext().getBean("flexibleSearchService");
     }
     
     protected static final ModelService getModelService(){
     return (ModelService) Registry.getApplicationContext().getBean("modelService");
     }
     
     protected static final CommonI18NService getCommonI18NService(){
     return (CommonI18NService) Registry.getApplicationContext().getBean("commonI18NService");
     }
     
     protected static final VoucherService getVoucherService(){
     return (VoucherService) Registry.getApplicationContext().getBean("voucherService");
     }
 
     protected static final ProductService getProductService(){
     return (ProductService) Registry.getApplicationContext().getBean("productService");
     }
 
     protected static final CatalogVersionService getCatalogVersionService(){
     return (CatalogVersionService) Registry.getApplicationContext().getBean("catalogVersionService");
     }
 }
 

Thanks to all for any suggestion. Danilo.

Accepted Solutions (1)

Accepted Solutions (1)

former_member469962
Contributor
0 Kudos

Hi Danilo,

From the exception trace:Could not instantiate bean class [com.accenture.hybris.facades.customerservice.impl.CoopCSTicketFacade]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

May be you are trying to perform some operation on a autowired bean in CoopCSTicketFacade before the constructor of CoopCSTicketFacade is called?

Regards, Shwetha

Answers (1)

Answers (1)

Former Member
0 Kudos

Look at this part of the error: "'csTicketFacade' defined in class path resource [CoopAcceleratorFrontEndfacades-spring.xml]: "

There is probably a syntax error in that xml file, or the class specified in the xml doesn't exist.

Former Member
0 Kudos

Hi Ian, The configuration is correct. I'm try to migrate the version from 4.8 to 5.5.0.6. The context is null. Thank you for the answer. Ciao. Danilo

Former Member
0 Kudos

Hi , I am also facing the same issue in Hybris 5.7. we are doing platform migration from 5.0 to 5.7. Please let me know if you have solution for this error.

Thanks, Mallikharjuna