SAP integration extensions 'add by name' issue

Adding any of SAP datahub integration extension in localextensions.xml leads to build error with root cause Extension doesn't specify a path and no scanned extension was matching the name.

For example, if will be added extensions:

1
2
3

<extension name="sapcustomerb2b"/>
<extension name="sapcustomerb2bbackoffice"/>

Ant build will failed with error:

 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
73
74
75
76
77
78
79
80
81
82
83
Buildfile: /home/clutcher/projects/hybris/bin/platform/build.xml
[ysetplatformproperties] Error while evaluating file '/home/clutcher/projects/hybris/config/localextensions.xml'. Extension 'sapcustomerb2b' doesn't specify a path and no scanned extension was matching the name. Please check file /home/clutcher/projects/hybris/config/localextensions.xml.
[ysetplatformproperties] java.lang.RuntimeException: Error while evaluating file '/home/clutcher/projects/hybris/config/localextensions.xml'. Extension 'sapcustomerb2b' doesn't specify a path and no scanned extension was matching the name. Please check file /home/clutcher/projects/hybris/config/localextensions.xml.
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.readConfiguredExtensionsFromXMLFile(PlatformConfig.java:1219)
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.collectConfiguredExtensionsFromXMLConfig(PlatformConfig.java:1041)
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.collectConfiguredExtensions(PlatformConfig.java:953)
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.<init>(PlatformConfig.java:139)
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.getInstance(PlatformConfig.java:128)
[ysetplatformproperties] 	at de.hybris.ant.taskdefs.PlatformConfigAntUtils.loadPlatformConfig(PlatformConfigAntUtils.java:60)
[ysetplatformproperties] 	at de.hybris.ant.taskdefs.PlatformConfigAntUtils.getOrLoadPlatformConfig(PlatformConfigAntUtils.java:36)
[ysetplatformproperties] 	at de.hybris.ant.taskdefs.SetPlatformProperties.setAllProperties(SetPlatformProperties.java:191)
[ysetplatformproperties] 	at de.hybris.ant.taskdefs.SetPlatformProperties.execute(SetPlatformProperties.java:114)
[ysetplatformproperties] 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[ysetplatformproperties] 	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[ysetplatformproperties] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ysetplatformproperties] 	at java.lang.reflect.Method.invoke(Method.java:498)
[ysetplatformproperties] 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[ysetplatformproperties] 	at org.apache.tools.ant.Task.perform(Task.java:348)
[ysetplatformproperties] 	at org.apache.tools.ant.Target.execute(Target.java:435)
[ysetplatformproperties] 	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:168)
[ysetplatformproperties] 	at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:230)
[ysetplatformproperties] 	at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162)
[ysetplatformproperties] 	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[ysetplatformproperties] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ysetplatformproperties] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ysetplatformproperties] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ysetplatformproperties] 	at java.lang.reflect.Method.invoke(Method.java:498)
[ysetplatformproperties] 	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[ysetplatformproperties] 	at org.apache.tools.ant.Task.perform(Task.java:348)
[ysetplatformproperties] 	at org.apache.tools.ant.Target.execute(Target.java:435)
[ysetplatformproperties] 	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
[ysetplatformproperties] 	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
[ysetplatformproperties] 	at org.apache.tools.ant.Main.runBuild(Main.java:826)
[ysetplatformproperties] 	at org.apache.tools.ant.Main.startAnt(Main.java:235)
[ysetplatformproperties] 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[ysetplatformproperties] 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
[ysetplatformproperties] Caused by: de.hybris.bootstrap.config.BootstrapConfigException: Extension 'sapcustomerb2b' doesn't specify a path and no scanned extension was matching the name. Please check file /home/clutcher/projects/hybris/config/localextensions.xml.
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.createExtensionInfoFromXML(PlatformConfig.java:1394)
[ysetplatformproperties] 	at de.hybris.bootstrap.config.PlatformConfig.readConfiguredExtensionsFromXMLFile(PlatformConfig.java:1212)
[ysetplatformproperties] 	... 32 more

BUILD FAILED
/home/clutcher/projects/hybris/bin/platform/build.xml:16: The following error occurred while executing this line:
/home/clutcher/projects/hybris/bin/platform/resources/ant/antmacros.xml:119: java.lang.RuntimeException: Error while evaluating file '/home/clutcher/projects/hybris/config/localextensions.xml'. Extension 'sapcustomerb2b' doesn't specify a path and no scanned extension was matching the name. Please check file /home/clutcher/projects/hybris/config/localextensions.xml.
	at de.hybris.bootstrap.config.PlatformConfig.readConfiguredExtensionsFromXMLFile(PlatformConfig.java:1219)
	at de.hybris.bootstrap.config.PlatformConfig.collectConfiguredExtensionsFromXMLConfig(PlatformConfig.java:1041)
	at de.hybris.bootstrap.config.PlatformConfig.collectConfiguredExtensions(PlatformConfig.java:953)
	at de.hybris.bootstrap.config.PlatformConfig.<init>(PlatformConfig.java:139)
	at de.hybris.bootstrap.config.PlatformConfig.getInstance(PlatformConfig.java:128)
	at de.hybris.ant.taskdefs.PlatformConfigAntUtils.loadPlatformConfig(PlatformConfigAntUtils.java:60)
	at de.hybris.ant.taskdefs.PlatformConfigAntUtils.getOrLoadPlatformConfig(PlatformConfigAntUtils.java:36)
	at de.hybris.ant.taskdefs.SetPlatformProperties.setAllProperties(SetPlatformProperties.java:191)
	at de.hybris.ant.taskdefs.SetPlatformProperties.execute(SetPlatformProperties.java:114)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:168)
	at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:230)
	at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
	at org.apache.tools.ant.Main.runBuild(Main.java:826)
	at org.apache.tools.ant.Main.startAnt(Main.java:235)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: de.hybris.bootstrap.config.BootstrapConfigException: Extension 'sapcustomerb2b' doesn't specify a path and no scanned extension was matching the name. Please check file /home/clutcher/projects/hybris/config/localextensions.xml.
	at de.hybris.bootstrap.config.PlatformConfig.createExtensionInfoFromXML(PlatformConfig.java:1394)
	at de.hybris.bootstrap.config.PlatformConfig.readConfiguredExtensionsFromXMLFile(PlatformConfig.java:1212)
	... 32 more

Total time: 1 second

To understand root of the problem we will debug ant target. To do this export ANT_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000" must be executed in linux terminal, after that Intellij IDEA will be able to debug ant target.

Debugging of de.hybris.bootstrap.config.PlatformConfig will show, that allScannedExtensions variable in collectConfiguredExtensionsFromSystemProperties method is not populated with sap integration extensions due to scanning of extensions has limited dir depth scan, by default dir depth equals 3 and sap integration extensions are placed on depth level 4.

To fix ant build error must be increased default scan depth:

1
2

<path dir='${HYBRIS_BIN_DIR}' autoload='false' depth='4'/>

Or must be added separate path for better performance:

1
2
3
4
5

<path dir='${HYBRIS_BIN_DIR}' autoload='false'/>

        <!-- Allows to find sap integration extensions via name attribute -->
<path dir='${HYBRIS_BIN_DIR}/ext-integration/sap' depth='2' autoload='false'/>
comments powered by Disqus