Skip to Content
author's profile photo Former Member
Former Member

Error initializing global application context!

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 21, 2016 at 10:57 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 20, 2016 at 08:26 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.