• 1 reply
  • Latest Post - ‏2012-10-18T13:53:16Z by Michael Burati
1493 Posts

Pinned topic RuntimeException: Could not instantiate parser WASCE

‏2012-10-18T05:01:11Z |
When i migrate my project from WAS to WASCE, In my project use xerces.jar and castor-xml.jar to parse xml config file,there occurs following errror:
java.lang.RuntimeException: Could not instantiate parser org.apache.xerces.parsers.SAXParser: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
at org.exolab.castor.util.LocalConfiguration.getParser(
at org.exolab.castor.util.LocalConfiguration.getParser(
at org.exolab.castor.xml.Unmarshaller.unmarshal(
at org.exolab.castor.xml.Unmarshaller.unmarshal(
at com.dxz.parse.BookUnmarshall.unmarshall(
This behavior does not occur in websphere,weblogic,jboss and EAserver.

For verify this error,i wirte a demo as attached,after deployed this demo, visit http://localhost:8080/TestWASCE/index.jsp will call unmarshaller.unmarshal() method.


java code:

FileReader reader = new FileReader("c:/temp/wasce/sample.xml");
Unmarshaller unmarshaller = new Unmarshaller(BookInfo.class);
BookInfo book = (BookInfo)unmarshaller.unmarshal(reader); //occur error
System.out.println("Subject "+book.getSubject());

xml file:


<?xml version="1.0" encoding="utf-8"?>



<export-name>my name</exprot>



<?xml version="1.0" encoding="utf-8"?>


<class name="com.dxz.parse.BookInfo">

<map-to xml="Book_Info"/>

<field name="subject" type="java.lang.String">

<bind-xml name="title" node="element"/>





<?xml version="1.0" encoding="utf-8"?>


<subject>Science ddddddd</subject>



Any thoughts/ideas are greatly appreciated.

Updated on 2012-10-18T13:53:16Z at 2012-10-18T13:53:16Z by Michael Burati
  • Michael Burati
    Michael Burati
    427 Posts

    Re: RuntimeException: Could not instantiate parser WASCE

    This forum is mainly for (and monitored by experts in) getting started with IBM Web Experience Factory tooling for building webapps, mobile webapps and portlets. Based on the info in your question (including non-IBM appservers that WEF does not support), it does not look like you are using Web Experience Factory, so you may have ended up in the wrong forum somehow.

    It looks like your app is trying to find the Xerces SAX Parser and cannot find that class in any jars in the classpath. You might want to use your favorite search engine to search for that class ( jars containing org.apache.xerces.parsers.SAXParser ) to familiarize yourself with where that comes from.

    I hope that info helps,
    ..Mike Burati
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.