Selenium (XercesImpl) 和 Google App Engine 出现问题
我从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 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.