This issue seems to have plagued Hybris commerce suite right from version 5.6 to the most recent version 5.7.0.5, There have been several solutions being discussed on the hybris expert forums to workaround the issue. However, I wanted to share the official answer from SAP to workaround this error.
NPE exception while accessing custom store generated using modulegen
Steps for Reconstruction
>ant all
>ant modulegen -Dinput.module=accelerator -Dinput.name=myb2c -Dinput.package=org.myb2c
Added following to localextensions.xml
- <hybrisconfig xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='../bin/platform/resources/schemas/extensions.xsd'>
- <extensions>
- <path dir='${HYBRIS_BIN_DIR}' />
- <extension name='mcc' />
- <extension name='backoffice' />
- <extension name='commercesearchbackoffice' />
- <extension name='commerceservicesbackoffice' />
- <extension name='solrfacetsearchbackoffice' />
- <extension name='solrserver' />
- <!-- OOB Store -->
- <!-- https://localhost:9002/yacceleratorstorefront/electronics/en/?site=electronics -->
- <!--extension name='yacceleratorcockpits' />
- <extension name='yacceleratorinitialdata' />
- <extension name='yacceleratorstorefront' />
- <extension name='yacceleratorfulfilmentprocess'/-->
- <!-- Custom Store -->
- <!-- https://localhost:9002/myb2cstorefront/electronics/en/?site=electronics -->
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2ccore"/>
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2cfacades"/>
- <!--extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2ctest"/-->
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2cfulfilmentprocess"/>
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2cstorefront"/>
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2cinitialdata"/>
- <extension dir="${HYBRIS_BIN_DIR}/custom/myb2c/myb2ccockpits"/>
- <extension name='yaddon' />
- <extension name='ycommercewebservices' />
- <extension name='electronicsstore' />
- <extension name='apparelstore' />
- <extension name='liveeditaddon' />
- <extension name='acceleratorwebservicesaddon' />
- </extensions>
- </hybrisconfig>
>ant all
>ant modulegen -Dinput.module=accelerator -Dinput.name=myb2c -Dinput.package=org.myb2c
Navigate to
Workaround for the issue
3 properties should be added for the custom storefront in local.properties
- myb2cstorefront.additionalWebSpringConfigs.liveeditaddon=classpath:/liveeditaddon/web/spring/liveeditaddon-storefront-web-spring.xml
- cmsPageBeforeViewHandler=org.myb2c.storefront.interceptors.beforeview.CmsPageBeforeViewHandler
- uiThemeResourceBeforeViewHandler=org.myb2c.storefront.interceptors.beforeview.UiThemeResourceBeforeViewHandler
after that, please do 'ant clean all', and restart hybris server
Navigate to
A defect has been logged with hybris to fix this issue in version 5.7, until the fix is available you may use the workaround provide by SAP to circumvent this error.