Skip to Content
0
Former Member
Jun 20, 2016 at 03:18 PM

Sessionservice Issue in ThreadPoolExecutor

444 Views

Hello,

for an XML-based product import I am trying to run multiple consumer threads for the product import. As part of the import process my Runnable tries to load a product before importing it. I am using the method DefaultProductService.getProductForCode to retrieve the product. The injected product service instance is shared among the threads in the thread pool. Unfortunately when I run the import as an integration test I receive the following Stacktrace:

] Exception in thread "pool-5-thread-1" java.lang.NullPointerException [yunitint] at de.hybris.platform.servicelayer.session.impl.DefaultSessionService.executeInLocalView(DefaultSessionService.java:94) [yunitint] at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.getJaloResult(DefaultFlexibleSearchService.java:396) [yunitint] at de.hybris.platform.servicelayer.search.impl.DefaultFlexibleSearchService.search(DefaultFlexibleSearchService.java:168) [yunitint] at de.hybris.platform.servicelayer.internal.dao.DefaultGenericDao.find(DefaultGenericDao.java:53) [yunitint] at de.hybris.platform.product.daos.impl.DefaultProductDao.findProductsByCode(DefaultProductDao.java:117) [yunitint] at de.hybris.platform.product.impl.DefaultProductService.getProductForCode(DefaultProductService.java:175) [yunitint] at X.core.services.impl.DefaultXImportService$ProductImportTask.loadOrCreateProduct(DefaultXService.java:671) [yunitint] at X.core.services.impl.DefaultXImportService$ProductImportTask.run(DefaultXImportService.java:614) [yunitint] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [yunitint] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [yunitint] at java.lang.Thread.run(Thread.java:745)

It seems as if the session service returns a null session but I do not understand why this is the case nor how to fix it.