# StackOverflowError at DefaultInputComponent.equals

**URL:** <https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324>\
**Category:** SonarQube Server / Community Build\
**Created:** [February 19, 2020, 2:14am UTC](https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324 "2020-02-19T02:14:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Swan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrew_swan/32/9395_2.png) [@Andrew\_Swan](https://community.sonarsource.com/u/Andrew_Swan)\
**Post date:** [February 19, 2020, 2:14am UTC](https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324/1 "2020-02-19T02:14:53Z")

</div>

I’m getting this error when running `mvn clean verify sonar:sonar`:

```auto
Exception in thread "main" java.lang.StackOverflowError
	at org.sonar.api.batch.fs.internal.DefaultInputComponent.equals(DefaultInputComponent.java:48)
	at com.google.common.collect.SingletonImmutableBiMap.get(SingletonImmutableBiMap.java:56)
	at com.google.common.collect.ImmutableListMultimap.get(ImmutableListMultimap.java:285)
	at com.google.common.collect.ImmutableListMultimap.get(ImmutableListMultimap.java:55)
	at org.sonar.scanner.scan.DefaultInputModuleHierarchy.children(DefaultInputModuleHierarchy.java:69)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:49)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)
	at org.sonar.scanner.scan.WorkDirectoriesInitializer.cleanAllWorkingDirs(WorkDirectoriesInitializer.java:50)

```

This happens with both version 3.6.0.1398 and version 3.7.0.1746 of the `sonar-maven-plugin`. Is this a known issue? I searched but couldn’t find anything similar.

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [February 19, 2020, 4:48pm UTC](https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324/2 "2020-02-19T16:48:33Z")

</div>

Hi,

Could you provide a little more log context? Also, what’s the structure of your project?

&nbsp;  
Thx,  
Ann

---

<div class="post-metadata">

**Author:** ![Andrew\_Swan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andrew_swan/32/9395_2.png) [@Andrew\_Swan](https://community.sonarsource.com/u/Andrew_Swan)\
**Post date:** [February 20, 2020, 12:03am UTC](https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324/5 "2020-02-20T00:03:28Z")

</div>

I figured it out after attaching my debugger. I have a multi-module Maven project, and in the root POM I had set the property `<sonar.projectKey>foo</sonar.projectKey>`, which then propagated into the sub-modules, of course. When `WorkDirectoriesInitializer.cleanAllWorkingDirs` went to recurse through the project, it calculated a key for each module, but it did this by reading the `sonar.projectKey` property. Because this had the same value for every module, the recursion never completed and the stack overflowed.

The fix in my case (which I found on StackOverflow, of course) was to add `<sonar.moduleKey>${project.artifactId}</sonar.moduleKey>` to the root POM, which evaluates to a different value for each sub-module and thereby allows the recursion to complete.

---

<div class="post-metadata">

**Author:** ![dmeneses](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dmeneses/32/2933_2.png) [@dmeneses](https://community.sonarsource.com/u/dmeneses)\
**Post date:** [February 20, 2020, 12:54am UTC](https://community.sonarsource.com/t/stackoverflowerror-at-defaultinputcomponent-equals/20324/6 "2020-02-20T00:54:13Z")

</div>

Thanks for the update!
