cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Seeing java.lang.NullPointerException while server startup

Former Member
1,911

Hello Experts,

I'm getting the below mentioned error while server start up, once the server is up and running I can't access Backoffice. The version used is Hybris 6.3. This is happening when connecting to my local.

After further analysis I found that we see this exception when it tries to cache few types mentioned in the backoffice-web-spring.xml as apart of backofficeWarmUpTypeFacadeCaches bean.

At one point it calls DefaultLocalizationService.getSupportedLocales(DefaultLocalizationService.java:268) which in turn relies on JaloSession.getCurrentSession().getUser().getPK() value (which is null) to run a flex query hence the null pointer exception.

Since I am still at the server startup step I am assuming that the User value is returned as null. Do you guys know if we can default the user details somewhere so that it doesn't return a null value?

Below is the stack trace:

 2018-07-24 13:33:16,224 loglevel=ERROR, remoteaddr=, classname=Configuration, msg="Failed to invoke class org.zkoss.spring.init.SecurityWebAppInit"
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'backofficeWarmUpTypeFacadeCaches' defined in ServletContext resource [/WEB-INF/backoffice-web-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at de.hybris.platform.spring.HybrisContextLoaderListener.doInitWebApplicationContext(HybrisContextLoaderListener.java:167) ~[coreserver.jar:?]
     at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:143) ~[coreserver.jar:?]
     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at de.hybris.platform.spring.HybrisContextLoaderListener.contextInitialized(HybrisContextLoaderListener.java:79) ~[coreserver.jar:?]
     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016) [catalina.jar:7.0.59]
     at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524) [catalina.jar:7.0.59]
     at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.59]
     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) [catalina.jar:7.0.59]
     at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) [catalina.jar:7.0.59]
     at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_162]
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_162]
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_162]
     at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162]
 Caused by: java.lang.NullPointerException
     at de.hybris.platform.servicelayer.internal.i18n.impl.DefaultLocalizationService.getSupportedLocales(DefaultLocalizationService.java:268) ~[coreserver.jar:?]
     at de.hybris.platform.servicelayer.internal.i18n.impl.DefaultLocalizationService.getSupportedDataLocales(DefaultLocalizationService.java:251) ~[coreserver.jar:?]
     at de.hybris.platform.servicelayer.i18n.impl.DefaultI18NService.getSupportedLocales(DefaultI18NService.java:205) ~[coreserver.jar:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.convertType(DefaultPlatformTypeFacadeStrategy.java:361) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.loadAndCache(DefaultPlatformTypeFacadeStrategy.java:220) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.convertAttribute(DefaultPlatformTypeFacadeStrategy.java:410) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.convertType(DefaultPlatformTypeFacadeStrategy.java:347) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.loadAndCache(DefaultPlatformTypeFacadeStrategy.java:220) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.backoffice.cockpitng.dataaccess.facades.type.DefaultPlatformTypeFacadeStrategy.load(DefaultPlatformTypeFacadeStrategy.java:161) ~[DefaultPlatformTypeFacadeStrategy.class:?]
     at com.hybris.cockpitng.dataaccess.facades.type.impl.DefaultTypeFacade.load(DefaultTypeFacade.java:45) ~[cockpit-data-integration-6.3.0.8-RC1.jar:?]
     at com.hybris.cockpitng.dataaccess.facades.type.impl.DefaultTypeFacade.load(DefaultTypeFacade.java:52) ~[cockpit-data-integration-6.3.0.8-RC1.jar:?]
     at com.hybris.backoffice.config.WarmUpTypeFacadeCaches.cacheTypesAndLoadStrategies(WarmUpTypeFacadeCaches.java:77) ~[WarmUpTypeFacadeCaches.class:?]
     at com.hybris.backoffice.config.WarmUpTypeFacadeCaches.warmUpCaches(WarmUpTypeFacadeCaches.java:56) ~[WarmUpTypeFacadeCaches.class:?]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1711) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1650) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
     ... 24 more


Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Likes

Since the server is not up yet, you cannot even run the impex to upload the users. I would suggest you run the following command from command prompt.

Go to your platform directory and run

ant initialize

make sure your localextensions.xml file include apparelstore and/or electronics store. Including these in your localextension.xml will enable Hybris to run impexes in these extensions during initialize.

once the system is initialized, do an ant clean all followed by hybrisserver.bat or hybrisserver.sh depending if you are on windows or unix.

Former Member
0 Likes

Hello Saurabh,

Thank you for your response.

I already have users in the DB. The issue is that during server start up, a Jalosession is initiated with master tenant but the userid is set as null.