I am calling a jar file from CF. Inside CF I have created a java class object successfully. When I am going to call my function that time, it generates the following error:
java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:10648" "listen,resolve")
How can I overcome this exception? I have deployed our code in a CF 10 server. Here is my login.cfm file code:
<cfsetting requesttimeout="1000000"> 
<!---Setting phantomJS path start--->
<cfset phantompath = #ExpandPath("./")# & "phantomjs\phantomjs.exe">    
<cfoutput>#phantompath#</cfoutput>
<!---Setting phantomJS path ends--->
<cfset sessionCookies="">
<!---Script for setting JAR file and creating java class object--->
<cfscript>
    paths = arrayNew(1);
    paths[1] = expandPath("CFDevshop\lib\Counsel_Cookies_Phantom.jar");
    writeDump(paths);
    loader = createObject("component", "javaloader.JavaLoader").init(paths);
    writedump(loader);
    classObject = loader.create("counsel_cookies.Counsel_Cookies").init();
    writedump(classObject);
    try{
        sessiondata=classObject.getSessionCookies  ("XXX","XXX","https://paser.login.csologin/login.jsf","phantomjs.exe");
    } 
    catch(Any e) { 
        WriteOutput("<p>An Expression exception was thrown.</p>");
        WriteOutput("<p>#e.Message#</p>");
    }
    writedump(sessiondata);                 
</cfscript>
Here is my java code:
public String getSessionCookies(String user, String pass,String loginUrl,String phantomPath) {
         StringBuilder builder=new StringBuilder();        
    try{            
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setJavascriptEnabled(true);// not really needed: JS enabled by default
        caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomPath);  
        driver = new PhantomJSDriver(caps);
        driver.get(loginUrl);
        System.out.println(driver.getTitle());
        driver.findElement(By.id("login:loginName")).sendKeys(user);
        driver.findElement(By.id("login:password")).sendKeys(pass);
        waitForJQueryProcessing(driver, 5);
        driver.findElement(By.xpath("/html/body/div[3]/div/div[1]/div[1]/div[15]/div[2]/form/div[2]/button[1]")).click();
        Thread.sleep(10000);
        Set<org.openqa.selenium.Cookie> allCookies=driver.manage().getCookies();
        builder.append(" : Thakre2");
        for ( org.openqa.selenium.Cookie loadedCookie : allCookies) {
            builder.append(String.format("%s->%s, ", loadedCookie.getName(),loadedCookie.getValue()));
                   //System.out.println(String.format("%s->%s, ", loadedCookie.getName(),loadedCookie.getValue()));
        }           
    } catch(Exception e){
        writeFile(e.toString(),logfilepath);
    }
    return builder.toString();
}
Please provide your suggestions. How can I resolve this exception?