Selenium (XercesImpl) 和 Google App Engine 出现问题

发布于 2024-11-10 03:58:47 字数 6021 浏览 5 评论 0原文

我从 Selenium 下载页面 下载了 selenium-java-2.0b3.zip。我将其解压并将所有 .jar 添加到一个简单 Eclipse 项目的构建路径中:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;


public class Main {
    public static void main(String[] args) {
        WebDriver driver = new HtmlUnitDriver();
        driver.get("http://www.google.com");
        System.out.println(driver.getPageSource());
    }
}

这工作正常。然后,我尝试将所有库添加到 GWT/GAE 项目的构建路径中。如果不添加任何引用库的代码,当我尝试运行该项目时,我会看到这些错误:

Initializing AppEngine server
Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Successfully processed foo\war\WEB-INF/appengine-web.xml
Successfully processed foo\war\WEB-INF/web.xml
[WARN] failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@495e160e{/,foo\war}: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[WARN] failed JettyContainerService$ApiProxyHandler@3ffa16c3: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[WARN] Error starting handlers
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    at org.mortbay.xml.XmlParser.setValidating(XmlParser.java:91)
    at org.mortbay.xml.XmlParser.<init>(XmlParser.java:83)
    at org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:210)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
    at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:157)
    at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:169)
    at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:119)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[WARN] Nested in javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found:
java.lang.ClassNotFoundException: org.apache.xerces.jaxp.SAXParserFactoryImpl
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.getProviderClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
    at javax.xml.parsers.FactoryFinder.find(Unknown Source)
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    at org.mortbay.xml.XmlParser.setValidating(XmlParser.java:91)
    at org.mortbay.xml.XmlParser.<init>(XmlParser.java:83)
    at org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:210)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
    at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:157)
    at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:169)
    at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:119)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
The server is running at http://localhost:8888/

我做错了什么?

更新这个问题可能会有一些启示。

更新 2这个问题

I downloaded selenium-java-2.0b3.zip from the Selenium Downloads page. I unzipped it and added all the .jars to the build path of a simple Eclipse project:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;


public class Main {
    public static void main(String[] args) {
        WebDriver driver = new HtmlUnitDriver();
        driver.get("http://www.google.com");
        System.out.println(driver.getPageSource());
    }
}

This works fine. I then try to do add all the libraries to the build path of a GWT/GAE project. Without adding any code that references the libraries, I see these errors when I try to run the project:

Initializing AppEngine server
Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Successfully processed foo\war\WEB-INF/appengine-web.xml
Successfully processed foo\war\WEB-INF/web.xml
[WARN] failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@495e160e{/,foo\war}: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[WARN] failed JettyContainerService$ApiProxyHandler@3ffa16c3: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
[WARN] Error starting handlers
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    at org.mortbay.xml.XmlParser.setValidating(XmlParser.java:91)
    at org.mortbay.xml.XmlParser.<init>(XmlParser.java:83)
    at org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:210)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
    at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:157)
    at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:169)
    at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:119)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[WARN] Nested in javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found:
java.lang.ClassNotFoundException: org.apache.xerces.jaxp.SAXParserFactoryImpl
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.getProviderClass(Unknown Source)
    at javax.xml.parsers.FactoryFinder.newInstance(Unknown Source)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(Unknown Source)
    at javax.xml.parsers.FactoryFinder.find(Unknown Source)
    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
    at org.mortbay.xml.XmlParser.setValidating(XmlParser.java:91)
    at org.mortbay.xml.XmlParser.<init>(XmlParser.java:83)
    at org.mortbay.jetty.webapp.TagLibConfiguration.configureWebApp(TagLibConfiguration.java:210)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:224)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
    at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:157)
    at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:169)
    at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:119)
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
    at com.google.gwt.dev.DevMode.main(DevMode.java:309)
The server is running at http://localhost:8888/

What am I doing wrong?

Update: This question may have some insight.

Update 2: Possible duplicate of this question.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拍不死你 2024-11-17 03:58:47

将 Selenium 下载中的所有 jar 复制到 war/WEB-INF/lib 并将它们添加到构建路径中。

Copy all the jars in the Selenium download to war/WEB-INF/lib and add them to the build path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文