1

我使用 java、selenium 和 JFrame 组合了一个应用程序。当我尝试在 JNLP 页面中启动它时,它给了我这个错误:

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 文件。

4

1 回答 1

1

要执行该操作,JNLP 文件需要声明:

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

Put 就在该information部分之后。

于 2013-05-04T01:57:06.923 回答