Menu

Cannot find matching toolchain definitions for the following toolchain types jdk

In this case to resolve the build issue we need to create a toolchains.xml file in .m2 directory. And add the following lines into that file.


<?xml version="1.0" encoding="UTF-8"?>

<toolchains>

  <!-- JDK toolchains -->

  <toolchain>

    <type>jdk</type>

    <provides>

      <version>11</version>

      <vendor>oracle</vendor>

    </provides>

    <configuration>

      <jdkHome>C:\Program Files\Java\jdk-11.0.15</jdkHome>

    </configuration>

  </toolchain>

</toolchains>


Here you need to update the version of JDK and jdkHome path according to installed JDK version in your machine.

After updating toolchains.xml file, go back to your project and execute the command to build the project.


fatal: refusing to merge unrelated histories

While merge the two different branches one could face this issue when both the branches are not created with same parent or base branch. If still there is a need to merge or pull the code from another branch, then use the --allow-unrelated-histories with git pull command. This will ignore the histories error and forcefully pull the code from another branch.

e.g.

 git pull origin feature-new-git --allow-unrelated-histories


Cannot set properties of undefined (setting 'display')

In a scenario, I was trying to hide some HTML elements from the DOM at the runtime using the plain Javascript display property. When I was running the below JavaScript code to set the display=none for a particular element I was getting the error "Cannot set properties of undefined (setting 'display')".


document.getElementsByClassName("Feedback").style.display = "none";


This error I was seeing because the getElementsByClassName function was returning a list and hence system was unable to set the property because of ambiguity between list items. So to fix this we have to specify the index number next to getElementsByClassName function like below to set the style display=none.


document.getElementsByClassName('Feedback')[0].style.display = 'none';


The above statement will hide the first occurrence of an element that has class "Feedback".