From: Guillaume L. <gui...@gm...> - 2005-07-20 11:25:08
|
Hello ! I hit a strange problem (stack trace below). I get an XNIException when running my tests from Maven. The same tests (same code, same jars, ...) runs fine when run from Eclipse. I found some stuff on the net about JavaScript problems, and it seems related. When I deactivate JS with "client.setJavaScriptEnabled(false);" my test runs fine both in eclipse and in maven. I tried to enable logging by adding "log4j.logger.com.gargoylesoftware.htmlunit.javascript=3DDEBUG" to my log4j.properties but with no success (no log related to that error). It really bothers me that the tests run only in Eclipse. I suppose the problem comes from some Maven config I forgot, but i really cant see where. Any help appreciated ! Thanks a lot, Guillaume Stack trace : 2005-07-20 13:23:15,940 [main] ERROR ch.tecost.siems.usecase.resident.care.dma.a ssistant.DmaAssistantHttpTest - Uncatched Exception org.apache.xerces.xni.XNIException at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.j= ava:1 860) at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:789= ) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.jav= a:478 ) at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.jav= a:431 ) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder= .pars e(HTMLParser.java:330) at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.j= ava:2 45) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(= Defau ltPageCreator.java:115) at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(Defa= ultPa geCreator.java:84) at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebC= lient .java:709) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:3= 76) at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:4= 15) at ch.tecost.siems.usecase.resident.care.dma.assistant.DmaAssistant= HttpT est.getPage(DmaAssistantHttpTest.java:58) at ch.tecost.siems.usecase.resident.care.dma.assistant.DmaAssistant= HttpT est.testDmaAssistant(DmaAssistantHttpTest.java:50) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor= Impl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod= Acces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run= (JUni tTestRunner.java:325) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeIn= VM(JU nitTask.java:848) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(J= UnitT ask.java:556) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(J= UnitT ask.java:532) at org.apache.tools.ant.Task.perform(Task.java:341) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:1= 35) at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:2= 33) at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:1= 35) at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenG= oalTa g.java:79) at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.p= erfor mAction(MavenGoalTag.java:110) at com.werken.werkz.Goal.fire(Goal.java:639) at com.werken.werkz.Goal.attain(Goal.java:575) at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) at com.werken.werkz.Goal.attain(Goal.java:573) at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.= java: 671) at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263) at org.apache.maven.cli.App.doMain(App.java:488) at org.apache.maven.cli.App.main(App.java:1239) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor= Impl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod= Acces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.werken.forehead.Forehead.run(Forehead.java:551) at com.werken.forehead.Forehead.main(Forehead.java:581) |
From: Marc G. <mgu...@ya...> - 2005-07-20 12:38:53
|
Salut Guillaume, never seen that before (I use Eclipse all the time). Is it the full stack trace? Can you produce a minimal test illustrating the problem? Marc. Guillaume Lederrey wrote: > Hello ! > > I hit a strange problem (stack trace below). I get an XNIException > when running my tests from Maven. The same tests (same code, same > jars, ...) runs fine when run from Eclipse. > > I found some stuff on the net about JavaScript problems, and it > seems related. When I deactivate JS with > "client.setJavaScriptEnabled(false);" my test runs fine both in > eclipse and in maven. I tried to enable logging by adding > "log4j.logger.com.gargoylesoftware.htmlunit.javascript=DEBUG" to my > log4j.properties but with no success (no log related to that error). > > It really bothers me that the tests run only in Eclipse. I suppose > the problem comes from some Maven config I forgot, but i really cant > see where. Any help appreciated ! > > Thanks a lot, > > Guillaume > > > Stack trace : > > 2005-07-20 13:23:15,940 [main] ERROR > ch.tecost.siems.usecase.resident.care.dma.a > ssistant.DmaAssistantHttpTest - Uncatched Exception > org.apache.xerces.xni.XNIException > at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1 > 860) > at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:789) > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478 > ) > at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431 > ) > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) > at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.pars > e(HTMLParser.java:330) > at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:2 > 45) > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(Defau > ltPageCreator.java:115) > at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPa > geCreator.java:84) > at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient > .java:709) > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:376) > at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:415) > at ch.tecost.siems.usecase.resident.care.dma.assistant.DmaAssistantHttpT > est.getPage(DmaAssistantHttpTest.java:58) > at ch.tecost.siems.usecase.resident.care.dma.assistant.DmaAssistantHttpT > est.testDmaAssistant(DmaAssistantHttpTest.java:50) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > sorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUni > tTestRunner.java:325) > at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JU > nitTask.java:848) > at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitT > ask.java:556) > at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitT > ask.java:532) > at org.apache.tools.ant.Task.perform(Task.java:341) > at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185) > at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) > at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) > at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233) > at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88) > at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) > at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) > at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTa > g.java:79) > at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.perfor > mAction(MavenGoalTag.java:110) > at com.werken.werkz.Goal.fire(Goal.java:639) > at com.werken.werkz.Goal.attain(Goal.java:575) > at com.werken.werkz.Goal.attainPrecursors(Goal.java:488) > at com.werken.werkz.Goal.attain(Goal.java:573) > at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java: > 671) > at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263) > at org.apache.maven.cli.App.doMain(App.java:488) > at org.apache.maven.cli.App.main(App.java:1239) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. > java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces > sorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at com.werken.forehead.Forehead.run(Forehead.java:551) > at com.werken.forehead.Forehead.main(Forehead.java:581) > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: Guillaume L. <gui...@gm...> - 2005-07-20 13:06:41
|
On 7/20/05, Marc Guillemot <mgu...@ya...> wrote: > Salut Guillaume, Mais Bonjour tr=E8s cher Marc ! > never seen that before (I use Eclipse all the time). Is it the full stack= trace? Can you produce a minimal test > illustrating the problem? I enclose a very simple test that shows the same behaviour while checking "Google". Again, this test runs fine in Eclipse but doesnt runs from Maven. I send only the .java file for now. If you need, I can assemble a simple Maven project that shows the same failure. Can I send attachements to the list or should I post an http link to the Maven project ? Thanks a lot for the fast reply ! Guillaume |
From: Guillaume L. <gui...@gm...> - 2005-07-20 13:07:11
|
As usual, I forgot to enclose the .java file ... package ch.tecost.siems.usecase.resident.care.dma.assistant; import java.net.MalformedURLException; import java.net.URL; import junit.framework.TestCase; import org.apache.log4j.Logger; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class XNIExceptionHttpTest extends TestCase { private static final Logger logger =3D Logger =20 .getLogger(XNIExceptionHttpTest.class); private static final String BASE_TEST_URL =3D "http://www.google.ch"; private static final String SEARCH_FORM =3D "f"; =20 public static URL getUrl(String url) throws MalformedURLException { return new URL(BASE_TEST_URL + url); } private static final String TEST_PAGE =3D "/"; @Override public void setUp() throws Exception { super.setUp(); } public void testDmaAssistant() throws Exception { try { WebClient client =3D new WebClient(); HtmlPage page =3D getPage(client); validatePage(page); } catch (Throwable t) { logger.error("Uncatched Exception", t); } } public static HtmlPage getPage(WebClient client) throws Exception { URL url =3D getUrl(TEST_PAGE); logger.debug("Getting page : "); logger.debug(url); return (HtmlPage) client.getPage(url); } private static HtmlForm getForm(HtmlPage page) { return page.getFormByName(SEARCH_FORM); } private static void validatePage(HtmlPage page) throws Exception { logger.debug("Validating the page"); HtmlForm form =3D getForm(page); assertNotNull("Prescription form was not found !", form); } } |
From: Guillaume L. <gui...@gm...> - 2005-07-20 13:21:06
Attachments:
testXNIException.tar.gz
|
And here is the tar.gz with a full project ! I hope it also fails for you ;-) Thanks a lot for having a look at it ! Guillaume |
From: Marc G. <mgu...@ya...> - 2005-07-20 13:42:59
|
it works: it fails ;-) Quite strange. I'll try to investigate it. Marc. Guillaume Lederrey wrote: > And here is the tar.gz with a full project ! > > I hope it also fails for you ;-) > > Thanks a lot for having a look at it ! > > > Guillaume |
From: Guillaume L. <gui...@gm...> - 2005-07-20 13:46:56
|
On 7/20/05, Marc Guillemot <mgu...@ya...> wrote: > it works: it fails ;-) >=20 > Quite strange. I'll try to investigate it. >=20 Thanks a lot ! Guillaume |
From: Marc G. <mgu...@ya...> - 2005-07-20 14:43:52
|
Salut Guillaume, There are many nested XNIException and InvocationTargetException. Walking it up it appears that the root cause is: --- java.lang.LinkageError: loader constraints violated when linking org/w3c/dom/Node class at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.buildUsageMap(JavaScriptConfiguration.java:268) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:108) at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:201) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.getPageInfo(JavaScriptEngine.java:155) ... --- Removing the xmlParserAPIs dependency seems to solve the problem. I don't have time to do more investigations. If you need more help, please contact me privately. Marc. Guillaume Lederrey wrote: > On 7/20/05, Marc Guillemot <mgu...@ya...> wrote: > >>it works: it fails ;-) >> >>Quite strange. I'll try to investigate it. >> > > > > Thanks a lot ! > > Guillaume > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > |
From: Marc G. <mgu...@ya...> - 2005-07-20 14:52:25
|
or even better than removing the dependency: just add maven.junit.fork=yes in your project.properties Marc. |