1

我收到此错误:

java.lang.NoClassDefFoundError: java.net.URLStreamHandler is a restricted class. Please see the Google  App Engine developer's guide for more details.
    at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
    at com.gargoylesoftware.htmlunit.protocol.javascript.Handler.<init>(Handler.java:50)
    at com.gargoylesoftware.htmlunit.WebClient.<clinit>(WebClient.java:144)

运行我的 GAE 应用程序时,错误在此代码块内:

    // Setup the headless browser
    webClient = new WebClient();
    webClient.setWebConnection(new UrlFetchWebConnection(webClient));

我的应用程序配置为:

<dependency>
    <groupId>net.sourceforge.htmlunit</groupId>
    <artifactId>htmlunit</artifactId>
    <version>2.13-SNAPSHOT</version>
</dependency>

我相信HTMLUnit有一个补丁可以让它在 GAE 环境中工作,我会遗漏什么?

4

1 回答 1

2

看起来我忘了做'mvn clean',因为我使用了早期版本的 HtmlUnit,工件仍然在那里。

现在它起作用了!

于 2013-03-28T08:16:27.970 回答