I am newbie with selenium and writing selenium test cases, I am basically trying to modify existing code in order to enhance some functionality. 

I am creating a webDriver using the following code : 

        DesiredCapabilities capabilities=new DesiredCapabilities();
          capabilities.setBrowserName("firefox");
          capabilities.setCapability("key", true);
          capabilities.setCapability("key", "value");
        if (driverUrl != null) {
	  System.out.println(" Capabilities are "+capabilities.toString());
            try {
            	URL url = new URL(driverUrl);
            	System.out.println(" DriverUtil: createDriver() path: "+url.toString()+" protocol "+url.getProtocol()+" hostName :"+url.getHost()+" port "+url.getPort());
            	WebDriver driver = new RemoteWebDriver(url, capabilities);
            	System.out.println(" WebDriver is "+driver);
                return driver;
            } catch (MalformedURLException e) {
                throw new IllegalStateException("Failed to create remote web driver for url " + driverUrl, e);
            }
        }

The url as well as the capabilities have the following values :
     
     DriverUtil webDriver is http://xyz-qaa.abc.no
     Capabilities are Capabilities [{browserName=firefox, key=value}]

I have modified the url in this question but as such the url has a valid value and can be opened in the browser. 

But when I try to run the test cases I see this :

 Caused by:
        java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
            at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:218)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
            at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
            at heimdall.ui.webtest.DriverUtil.createDriver(DriverUtil.java:46)

I have looked around to find a solution for this but I am unable to find one. Any suggestions ?