2013-05-03 33 views
1

我使用java,selenium和JFrame組合了一個應用程序。當我嘗試啓動它在JNLP頁它給了我這個錯誤:如何使用Java和JFrame中的selenium來阻止此錯誤

java.security.AccessControlException: access denied ("java.util.PropertyPermission" "com.google.appengine.runtime.environment" "read") 
    at java.security.AccessControlContext.checkPermission(Unknown Source) 
    at java.security.AccessController.checkPermission(Unknown Source) 
    at java.lang.SecurityManager.checkPermission(Unknown Source) 
    at java.lang.SecurityManager.checkPropertyAccess(Unknown Source) 
    at java.lang.System.getProperty(Unknown Source) 
    at com.gargoylesoftware.htmlunit.gae.GAEUtils.isGaeMode(GAEUtils.java:35) 
    at com.gargoylesoftware.htmlunit.util.URLCreator.getCreator(URLCreator.java:48) 
    at com.gargoylesoftware.htmlunit.util.UrlUtils.<clinit>(UrlUtils.java:44) 
    at com.gargoylesoftware.htmlunit.WebClient.<clinit>(WebClient.java:160) 
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.newWebClient(HtmlUnitDriver.java:296) 
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.createWebClient(HtmlUnitDriver.java:270) 
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:136) 
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:179) 
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:175) 
    at googlePackage.GoogleClass.<init>(GoogleClass.java:21) 
    at googlePackage.GoogleClass.main(GoogleClass.java:31) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at com.sun.javaws.Launcher.executeApplication(Unknown Source) 
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source) 
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source) 
    at com.sun.javaws.Launcher.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 

我的JNLP文件

<?xml version="1.0" encoding="utf-8"?> 
<jnlp 
    spec="1.0+" 
    codebase="http://localhost/Java/SignSelenium/GoogleScan" 
    href="TwitterScan.jnlp"> 
    <information> 
    <title>FrameDemo2</title> 
    <vendor>The Java(tm) Tutorial</vendor> 
    <homepage href="http://localhost/Java/index.html"/> 
    <description>Frame2</description> 
    <description kind="short">buttons within containers</description> 
    <offline-allowed/> 
    </information> 
    <resources> 
    <j2se version="1.6+"/> 
    <jar href="GoogleScan.jar"/> 
    </resources> 
    <application-desc main-class="googlePackage.GoogleClass"/> 
</jnlp> 

我的班級

http://pastebin.com/sY9PHhvF

我有簽署了該jar包含的所有selenium jar文件。

回答

1

爲了做到這一點的動作,JNLP文件需要聲明:

<security> 
    <all-permissions /> 
</security> 

認沽剛information節之後。

+0

真棒!謝謝!! – 2013-05-04 17:19:27

相關問題