由于 Xerces 错误,Spring Roo 无法生成 Selenium 测试
看完 Roo Google IO 后,我决定尝试一下使用 本教程,但我在尝试时遇到了困难创建 Selenium 测试。
~.web roo> selenium test --controller ~.web.PizzaOrderController
Created SRC_MAIN_WEBAPP/selenium
Created SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Created SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Undo create SRC_MAIN_WEBAPP/selenium
com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
此论坛中的一个人建议从类路径中删除 Xerces,因为 Java 6 有其自己的基于Xerces的XML解析器。但是,我还没有找到从类路径中删除某些内容的明确方法,只有设置它(我认为每次都会很乏味)。
有谁知道从类路径中删除 jars 的明确方法?有没有人遇到过这个Roo问题并以其他方式解决过?
更新
根据要求,这里是更详细的输出:
roo> development mode
Development mode set to true
roo> selenium test --controller ~.web.PizzaOrderController
Created SRC_MAIN_WEBAPP/selenium
Created SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Created SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Undo create SRC_MAIN_WEBAPP/selenium
com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
at org.springframework.roo.addon.web.menu.MenuOperationsImpl.addMenuItem(MenuOperationsImpl.java:88)
at org.springframework.roo.addon.web.selenium.SeleniumOperationsImpl.manageTestSuite(SeleniumOperationsImpl.java:185)
at org.springframework.roo.addon.web.selenium.SeleniumOperationsImpl.generateTest(SeleniumOperationsImpl.java:140)
at org.springframework.roo.addon.web.selenium.SeleniumCommands.generateTest(SeleniumCommands.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191)
at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:34)
at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:169)
at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:132)
at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:32)
at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:158)
at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:200)
at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:126)
at java.lang.Thread.run(Thread.java:619)
After watching Roo Google IO, I decided to try it out using this tutorial, but I'm getting stuck when trying to create Selenium tests.
~.web roo> selenium test --controller ~.web.PizzaOrderController
Created SRC_MAIN_WEBAPP/selenium
Created SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Created SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Undo create SRC_MAIN_WEBAPP/selenium
com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
A person at this forum suggested removing Xerces from the classpath because Java 6 has its own XML parser based on Xerces. However, I haven't come across a clear way to remove something from the classpath, only setting it (which I think would be tedious each time).
Does anyone know of a clear way to remove jars from the classpath? Has anyone encountered this Roo problem before and solved it another way?
UPDATE
As requested, here is the more verbose output:
roo> development mode
Development mode set to true
roo> selenium test --controller ~.web.PizzaOrderController
Created SRC_MAIN_WEBAPP/selenium
Created SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Created SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-suite.xhtml
Undo create SRC_MAIN_WEBAPP/selenium/test-pizzaorder.xhtml
Undo create SRC_MAIN_WEBAPP/selenium
com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredCommentImpl cannot be cast to org.w3c.dom.Element
at org.springframework.roo.addon.web.menu.MenuOperationsImpl.addMenuItem(MenuOperationsImpl.java:88)
at org.springframework.roo.addon.web.selenium.SeleniumOperationsImpl.manageTestSuite(SeleniumOperationsImpl.java:185)
at org.springframework.roo.addon.web.selenium.SeleniumOperationsImpl.generateTest(SeleniumOperationsImpl.java:140)
at org.springframework.roo.addon.web.selenium.SeleniumCommands.generateTest(SeleniumCommands.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.roo.support.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:191)
at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy$1.callback(ProcessManagerHostedExecutionStrategy.java:34)
at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:169)
at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:132)
at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:32)
at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:158)
at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:200)
at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:126)
at java.lang.Thread.run(Thread.java:619)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能否输入“开发模式”,按 Enter 键,然后重新运行 Selenium 命令并包含后面更详细的堆栈跟踪?
Can you please type "development mode", press enter, then re-run the Selenium command and include the more detailed stack trace that follows?