Java.security.AccessControlException: Access Denied ("java.net.SocketPermission" "localhost: 10648" "listen, decide")
I am calling jar file from CF. Inside CF, I have successfully created a java class object. When I call my function in the meantime, it generates the following error:
java.security.AccessControlException: Access Denied ("java.net.SocketPermission" "localhost: 10648" "listen, decide")
How can I overcome this exception? I deployed our code to 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 submit your suggestions. How can I resolve this exception?
+3
Atu tha
source
to share
1 answer
I am guessing a resolution question. Edit client.policy or server.policy to grant read / read permissions.
More details here
0
Tattu
source
to share