Re: Issue 3 in thread-weaver: SAXParser cannot be cast to XMLReader

69 views
Skip to first unread message

thread...@googlecode.com

unread,
May 10, 2013, 7:09:21 PM5/10/13
to thread...@googlegroups.com

Comment #2 on issue 3 by abhinayn...@gmail.com: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at
com.google.testing.threadtester.MethodCaller.invoke(MethodCaller.java:71)
at
com.google.testing.threadtester.BaseThreadedTestRunner.runTests(BaseThreadedTestRunner.java:179)
at
com.google.testing.threadtester.BaseThreadedTestRunner.runTests(BaseThreadedTestRunner.java:165)
at
voldemort.client.rebalance.RebalanceMetadataConsistencyTest.testThreading(RebalanceMetadataConsistencyTest.java:160)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
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
com.google.testing.threadtester.MethodCaller.invoke(MethodCaller.java:68)
... 27 more
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
com.google.testing.threadtester.MethodCaller.invoke(MethodCaller.java:71)
at
com.google.testing.threadtester.AnnotatedTestWrapper$MainTestCaseRunner.initialize(AnnotatedTestWrapper.java:311)
at
com.google.testing.threadtester.InterleavedRunner.doInterleave(InterleavedRunner.java:137)
at
com.google.testing.threadtester.InterleavedRunner.interleave(InterleavedRunner.java:80)
at
com.google.testing.threadtester.AnnotatedTestWrapper.runTestCases(AnnotatedTestWrapper.java:258)
at
com.google.testing.threadtester.AnnotatedTestWrapper.runTests(AnnotatedTestWrapper.java:242)
... 32 more
Caused by: java.lang.reflect.InvocationTargetException
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
com.google.testing.threadtester.MethodCaller.invoke(MethodCaller.java:68)
... 37 more
Caused by: voldemort.xml.MappingException: org.jdom.JDOMException: Could
not load default SAX parser: org.apache.xerces.parsers.SAXParser: SAX2
driver class org.apache.xerces.parsers.SAXParser does not implement
XMLReader: org.apache.xerces.parsers.SAXParser cannot be cast to
org.xml.sax.XMLReader
at voldemort.xml.ClusterMapper.readCluster(ClusterMapper.java:122)
at voldemort.xml.ClusterMapper.readCluster(ClusterMapper.java:95)
at
voldemort.utils.RebalanceUtils.createUpdatedCluster(RebalanceUtils.java:329)
at
voldemort.client.rebalance.RebalanceMetadataConsistencyTest.before(RebalanceMetadataConsistencyTest.java:85)
... 42 more
Caused by: org.jdom.JDOMException: Could not load default SAX parser:
org.apache.xerces.parsers.SAXParser: SAX2 driver class
org.apache.xerces.parsers.SAXParser does not implement XMLReader:
org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:618)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:460)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:888)
at voldemort.xml.ClusterMapper.readCluster(ClusterMapper.java:102)
... 45 more
Caused by: java.lang.ClassCastException:
org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at
org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:199)
at
org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:180)
at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:610)
... 48 more
Caused by: java.lang.ClassCastException:
org.apache.xerces.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at
org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:187)
... 50 more


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

thread...@googlecode.com

unread,
May 11, 2013, 9:30:54 PM5/11/13
to thread...@googlegroups.com

Comment #3 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

Hmm. When ThreadWeaver runs the tests, it has to reload the class under
test using a custom class loader. I wonder if the loaded class has
something missing in its classpath, which means that it cannot load the
necessary parser?

Is there any chance that you can can send me the code that you are trying
to test?

thread...@googlecode.com

unread,
May 13, 2013, 1:35:48 PM5/13/13
to thread...@googlegroups.com

Comment #4 on issue 3 by abhinayn...@gmail.com: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

sure it is open source ;-) I will push my changes in half a day

thread...@googlecode.com

unread,
May 13, 2013, 4:15:29 PM5/13/13
to thread...@googlegroups.com

thread...@googlecode.com

unread,
May 14, 2013, 12:41:47 AM5/14/13
to thread...@googlegroups.com

Comment #6 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

OK, thanks. I'll try and take a look tomorrow.

thread...@googlecode.com

unread,
May 14, 2013, 9:12:41 PM5/14/13
to thread...@googlegroups.com

Comment #7 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

This is caused by an error that we get when we try to invoke a native
method inside the org.jdom. parser code. This causes SAXBuilder to silently
swallow the error, and then try and use the DEFAULT_SAX_DRIVER instead.

The underlying problem is that we can't load classes containing native
methods inside the ThreadWeaver test framework. We have a hardcoded list of
various system and system-like classes that we don't load and instrument,
and I've added "org.jdom" rto the list. See
https://code.google.com/p/thread-weaver/source/detail?r=26

I'm not going to cut a new release yet as I want to fix things up a bit
more, but if you download the source you should be able to build easily.

Note that your RebalanceMetadataConsistencyTest.java class has some
problems. The static{} block needs to move into an instance method with the
@ThreadedBefore annotation, and there are still some null pointer issues.

You have:

rebalancer = new Rebalancer(null, metadataStore, null, null);
....
metadataStore = new MetadataStore(innerStore, 0);

which means that the Rebalancer has a null input. The two ines need to be
reversed, and even then I got some NPEs in the after() method.

Let me know if you have further issues with the test framework.

thread...@googlecode.com

unread,
May 15, 2013, 11:27:47 AM5/15/13
to thread...@googlegroups.com

Comment #8 on issue 3 by abhinayn...@gmail.com: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

Hi Alasdair,
thanks!
yes the tests has problems as I was trying to mock the class to get around
the xml issue .. and well it messed up the test. I will write a new test to
see if it works

best
abhinay

thread...@googlecode.com

unread,
Aug 7, 2013, 9:08:33 PM8/7/13
to thread...@googlegroups.com
Updates:
Status: Fixed

Comment #9 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

I have released a new build which includes revision r26, which should fix
this specific problem.

thread...@googlecode.com

unread,
May 15, 2014, 8:03:10 PM5/15/14
to thread...@googlegroups.com

Comment #10 on issue 3 by bimargul...@gmail.com: SAXParser cannot be cast
to XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

I've hit this with version 0.2 which is the newest on Maven Central. Does
that version have the fix? We're not using any native code.

thread...@googlecode.com

unread,
May 15, 2014, 8:07:51 PM5/15/14
to thread...@googlegroups.com

Comment #11 on issue 3 by bimargul...@gmail.com: SAXParser cannot be cast
to XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

The code that blows up for us is just:

XMLReader xr = XMLReaderFactory.createXMLReader();

No jdom, just good old sax.

thread...@googlecode.com

unread,
May 16, 2014, 1:11:01 PM5/16/14
to thread...@googlegroups.com
Updates:
Status: New

Comment #12 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
http://code.google.com/p/thread-weaver/issues/detail?id=3

Can you send me an example that reproduces this? Thanks.

thread...@googlecode.com

unread,
Nov 4, 2014, 2:05:40 AM11/4/14
to thread...@googlegroups.com
Updates:
Status: Invalid

Comment #13 on issue 3 by alasdair.mackintosh: SAXParser cannot be cast to
XMLReader
https://code.google.com/p/thread-weaver/issues/detail?id=3

Closing, as I don't have a way to reproduce this.
Reply all
Reply to author
Forward
0 new messages