You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.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:150)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
at org.dom4j.io.SAXReader.read(SAXReader.java:435)
org.hibernate.HibernateException: Could not parse configuration: inMemory-hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1528)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
...
..
Caused by: org.dom4j.DocumentException: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader Nested exception: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1518)
... 34 more
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1518)
Warning: Caught exception attempting to use SAX to load a SAX XMLReader
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
Warning: Exception was: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
Warning: I will print the stack trace then carry on using the default SAX parser
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
...
..
I've tried the recommendation suggested in the issue I mentioned above, without any luck:
@RunWith(PowerMockRunner.class)
@PrepareForTest({MyServiceImpl.class})
@PowerMockIgnore( { "com.sun.org.apache.xerces.", "org.dom4j.", "org.xml.sax.*" })
public class MyTest extends InMemoryLookupTests{
private MyServiceImpl service;
...
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
service = new MyServiceImpl();
....
}
From AlexWib...@gmail.com on July 28, 2010 08:58:48
Hi all,
First of all, my problem is probably similar to the following issue: http://groups.google.com/group/powermock/browse_thread/thread/88079512f2dfcbd1/59b5d831e3e7f9b8?pli=1 basically, I have a hibernate configuration that gets loaded in my test.
I'm getting the following error:
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.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:150)
at org.dom4j.io.SAXHelper.createXMLReader(SAXHelper.java:83)
at org.dom4j.io.SAXReader.createXMLReader(SAXReader.java:894)
at org.dom4j.io.SAXReader.getXMLReader(SAXReader.java:715)
at org.dom4j.io.SAXReader.read(SAXReader.java:435)
org.hibernate.HibernateException: Could not parse configuration: inMemory-hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1528)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
...
..
Caused by: org.dom4j.DocumentException: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader Nested exception: SAX2 driver class com.sun.org.apache.xerces.internal.parsers.SAXParser does not implement XMLReader
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1518)
... 34 more
Warning: Caught exception attempting to use SAX to load a SAX XMLReader
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
Warning: Exception was: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.parsers.SAXParser cannot be cast to org.xml.sax.XMLReader
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
Warning: I will print the stack trace then carry on using the default SAX parser
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
...
..
I've tried the recommendation suggested in the issue I mentioned above, without any luck:
@RunWith(PowerMockRunner.class)
@PrepareForTest({MyServiceImpl.class})
@PowerMockIgnore( { "com.sun.org.apache.xerces.", "org.dom4j.", "org.xml.sax.*" })
public class MyTest extends InMemoryLookupTests{
.....
}
Could someone please share some light?
Thanks in advance!
Regards,
Alex.
Original issue: http://code.google.com/p/powermock/issues/detail?id=270
The text was updated successfully, but these errors were encountered: