Getting exception org.openqa.selenium.SessionNotCreatedException

I created a grid set up and when I try to execute the scripts on grid I am getting org.openqa.selenium.SessionNotCreatedException exception.

Below is the minimal code to reproduce,

public class Gridtest {
        WebDriver driver;
        DesiredCapabilities cap;
        @Test
        public void runtest() throws MalformedURLException {        
             System.setProperty("webdriver.chrome.driver","D:\Selenium_Grid\chromedriver.exe");
             cap = DesiredCapabilities.chrome();
            URL url = new URL("http://192.168.0.107:4444/wd/hub");
            ChromeOptions options = new ChromeOptions();
            driver = new RemoteWebDriver(url, options);
            driver.get("http://google.com/");
            driver.close();
        }
    }

Exception:

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2021-08-14T08:25:53'
System info: host: 'SID', ip: '192.168.0.5', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_201'
Driver info: driver.version: unknown
Command duration or timeout: 145 milliseconds

Used command to register node to hub

java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.0.107:4444/grid/register/

Answer

You have to pass the driver location while registering node to hub.

java -Dwebdriver.chrome.driver ="Driver location" -jar selenium-server-standalone-3.141.59.jar -role node -hub http://192.168.0.107:4444/grid/register/