2021‑06‑04
Last updated on 2024-02-28
During migration on newer version of hybris you could find that Backoffice is not working due to failed context initialization with error in creating 'backofficeWarmUpTypeFacadeCaches'
bean. Root cause of that issue is broken itemtype definition in composedtypes
table.
To fix it:
Clean up orphaned types via HAC (“Clear all orphaned types” button in Maintenance->Cleanup section) to remove unused itemtypes from composedtypes table.
Update running system via HAC to update existing definitions.
Add missing ComposedTypes translation to fix NPE
Execute Flexible Search Query in HAC to find ComposedTypes with missing translations
1
SELECT {t.code}, {l.isocode}, {t.name[any]} FROM { ComposedType AS t JOIN Language as l ON lp_t0.langpk = {l.pk} } WHERE {t.name[any]} is null or {t.name[any]}=''
Add ALL missing language translation with impex, like
1
2
UPDATE ComposedType; code[unique = true] ; name[lang = en_US]
; DuplicateCatalogItemCodesView ; Duplicate identifiers
Restart hybris server
P.S. Example od error log:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
[ 2021 / 06 / 04 08 : 57 : 18 . 340 ] WARN [ localhost - startStop - 1 ] [ BackofficeApplicationContext ] Exception encountered during context initialization - cancelling refresh attempt : 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
[ 2021 / 06 / 04 08 : 57 : 18 . 360 ] ERROR [ localhost - startStop - 1 ] [ ContextLoader ] Context initialization failed
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 : 1794 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . doCreateBean ( AbstractAutowireCapableBeanFactory . java : 594 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . createBean ( AbstractAutowireCapableBeanFactory . java : 516 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory . lambda$doGetBean$0 ( AbstractBeanFactory . java : 324 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . DefaultSingletonBeanRegistry . getSingleton ( DefaultSingletonBeanRegistry . java : 234 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory . doGetBean ( AbstractBeanFactory . java : 322 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractBeanFactory . getBean ( AbstractBeanFactory . java : 202 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . DefaultListableBeanFactory . preInstantiateSingletons ( DefaultListableBeanFactory . java : 897 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . context . support . AbstractApplicationContext . finishBeanFactoryInitialization ( AbstractApplicationContext . java : 879 ) ~[ spring - context - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . context . support . AbstractApplicationContext . refresh ( AbstractApplicationContext . java : 551 ) ~[ spring - context - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . web . context . ContextLoader . configureAndRefreshWebApplicationContext ( ContextLoader . java : 401 ) ~[ spring - web - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . web . context . ContextLoader . initWebApplicationContext ( ContextLoader . java : 292 ) [ spring - web - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at de . hybris . platform . spring . HybrisContextLoaderListener . doInitWebApplicationContext ( HybrisContextLoaderListener . java : 226 ) [ coreserver . jar : ?]
at de . hybris . platform . spring . HybrisContextLoaderListener . initWebApplicationContext ( HybrisContextLoaderListener . java : 199 ) [ coreserver . jar : ?]
at org . springframework . web . context . ContextLoaderListener . contextInitialized ( ContextLoaderListener . java : 103 ) [ spring - web - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at de . hybris . platform . spring . HybrisContextLoaderListener . contextInitializedInternal ( HybrisContextLoaderListener . java : 96 ) [ coreserver . jar : ?]
at de . hybris . platform . spring . HybrisContextLoaderListener . contextInitialized ( HybrisContextLoaderListener . java : 91 ) [ coreserver . jar : ?]
at com . hybris . backoffice . BackofficeApplicationContextInitializer . contextInitialized ( BackofficeApplicationContextInitializer . java : 105 ) [ classes / : ?]
at org . apache . catalina . core . StandardContext . listenerStart ( StandardContext . java : 4705 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . core . StandardContext . startInternal ( StandardContext . java : 5171 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . util . LifecycleBase . start ( LifecycleBase . java : 183 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . core . ContainerBase . addChildInternal ( ContainerBase . java : 743 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . core . ContainerBase . addChild ( ContainerBase . java : 719 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . core . StandardHost . addChild ( StandardHost . java : 705 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . startup . HostConfig . deployDescriptor ( HostConfig . java : 672 ) [ catalina . jar : 8 . 5 . 64 ]
at org . apache . catalina . startup . HostConfig$DeployDescriptor . run ( HostConfig . java : 1873 ) [ catalina . jar : 8 . 5 . 64 ]
at java . util . concurrent . Executors$RunnableAdapter . call ( Executors . java : 515 ) [? : ?]
at java . util . concurrent . FutureTask . run ( FutureTask . java : 264 ) [? : ?]
at java . util . concurrent . ThreadPoolExecutor . runWorker ( ThreadPoolExecutor . java : 1128 ) [? : ?]
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( ThreadPoolExecutor . java : 628 ) [? : ?]
at java . lang . Thread . run ( Thread . java : 829 ) [? : ?]
Caused by : java . lang . NullPointerException
at com . google . common . base . Preconditions . checkNotNull ( Preconditions . java : 877 ) ~[ guava - 27 . 0 . 1 - jre . jar : ?]
at com . google . common . collect . StandardTable . put ( StandardTable . java : 147 ) ~[ guava - 27 . 0 . 1 - jre . jar : ?]
at com . google . common . collect . HashBasedTable . put ( HashBasedTable . java : 51 ) ~[ guava - 27 . 0 . 1 - jre . jar : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultTypeSystemLocalizationHelper . loadTypeLocalization ( DefaultTypeSystemLocalizationHelper . java : 183 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultTypeSystemLocalizationHelper . findTypeLocalization ( DefaultTypeSystemLocalizationHelper . java : 105 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultTypeSystemLocalizationHelper . localizeType ( DefaultTypeSystemLocalizationHelper . java : 73 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . convertType ( DefaultPlatformTypeFacadeStrategy . java : 362 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . loadAndCache ( DefaultPlatformTypeFacadeStrategy . java : 229 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . convertAttribute ( DefaultPlatformTypeFacadeStrategy . java : 523 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . lambda$7 ( DefaultPlatformTypeFacadeStrategy . java : 465 ) ~[ classes / : ?]
at java . util . stream . ReferencePipeline$3$1 . accept ( ReferencePipeline . java : 195 ) ~[? : ?]
at java . util . stream . ReferencePipeline$2$1 . accept ( ReferencePipeline . java : 177 ) ~[? : ?]
at java . util . stream . ReferencePipeline$2$1 . accept ( ReferencePipeline . java : 177 ) ~[? : ?]
at java . util . stream . ReferencePipeline$2$1 . accept ( ReferencePipeline . java : 177 ) ~[? : ?]
at java . util . Spliterators$ArraySpliterator . forEachRemaining ( Spliterators . java : 948 ) ~[? : ?]
at java . util . stream . AbstractPipeline . copyInto ( AbstractPipeline . java : 484 ) ~[? : ?]
at java . util . stream . AbstractPipeline . wrapAndCopyInto ( AbstractPipeline . java : 474 ) ~[? : ?]
at java . util . stream . ReduceOps$ReduceOp . evaluateSequential ( ReduceOps . java : 913 ) ~[? : ?]
at java . util . stream . AbstractPipeline . evaluate ( AbstractPipeline . java : 234 ) ~[? : ?]
at java . util . stream . ReferencePipeline . collect ( ReferencePipeline . java : 578 ) ~[? : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . convertAttributes ( DefaultPlatformTypeFacadeStrategy . java : 474 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . convertAndCacheAttributes ( DefaultPlatformTypeFacadeStrategy . java : 435 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . convertType ( DefaultPlatformTypeFacadeStrategy . java : 352 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . loadAndCache ( DefaultPlatformTypeFacadeStrategy . java : 229 ) ~[ classes / : ?]
at com . hybris . backoffice . cockpitng . dataaccess . facades . type . DefaultPlatformTypeFacadeStrategy . load ( DefaultPlatformTypeFacadeStrategy . java : 171 ) ~[ classes / : ?]
at com . hybris . cockpitng . dataaccess . facades . type . impl . DefaultTypeFacade . load ( DefaultTypeFacade . java : 39 ) ~[ cockpit - data - integration - 20 . 11 . 5 - RC5 . jar : ?]
at com . hybris . cockpitng . dataaccess . facades . type . impl . DefaultTypeFacade . load ( DefaultTypeFacade . java : 46 ) ~[ cockpit - data - integration - 20 . 11 . 5 - RC5 . jar : ?]
at com . hybris . backoffice . config . WarmUpTypeFacadeCaches . cacheTypesAndLoadStrategies ( WarmUpTypeFacadeCaches . java : 83 ) ~[ classes / : ?]
at com . hybris . backoffice . config . WarmUpTypeFacadeCaches . warmUpCaches ( WarmUpTypeFacadeCaches . java : 59 ) ~[ classes / : ?]
at jdk . internal . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method ) ~[? : ?]
at jdk . internal . reflect . NativeMethodAccessorImpl . invoke ( NativeMethodAccessorImpl . java : 62 ) ~[? : ?]
at jdk . internal . reflect . DelegatingMethodAccessorImpl . invoke ( DelegatingMethodAccessorImpl . java : 43 ) ~[? : ?]
at java . lang . reflect . Method . invoke ( Method . java : 566 ) ~[? : ?]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . invokeCustomInitMethod ( AbstractAutowireCapableBeanFactory . java : 1920 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . invokeInitMethods ( AbstractAutowireCapableBeanFactory . java : 1862 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
at org . springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . initializeBean ( AbstractAutowireCapableBeanFactory . java : 1790 ) ~[ spring - beans - 5 . 2 . 12 . RELEASE . jar : 5 . 2 . 12 . RELEASE ]
... 30 more