Topic
  • 1 reply
  • Latest Post - ‏2012-10-18T13:53:16Z by mburati
SystemAdmin
SystemAdmin
1493 Posts

Pinned topic RuntimeException: Could not instantiate parser org.apache.xerces...in WASCE

‏2012-10-18T05:01:11Z |
Hi,all
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:
================
server.log
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(LocalConfiguration.java:342)
at org.exolab.castor.util.LocalConfiguration.getParser(LocalConfiguration.java:273)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:703)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:588)
at com.dxz.parse.BookUnmarshall.unmarshall(BookUnmarshall.java:29)
...
...
================
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:

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

xml file:

c:/temp/wasce/1.xml

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

<name>duanxz</name>

<engine-container>database</engine-container>

<export-name>my name</exprot>

</body>

c:/temp/wasce/book-mapping.xml

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

<mapping>

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

<map-to xml="Book_Info"/>

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

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

</field>

</class>

</mapping>

c:/temp/wasce/sample.xml

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

<Book_Info>

<subject>Science ddddddd</subject>

<Book_Info>

********************

Any thoughts/ideas are greatly appreciated.

Thanks
duanxz
Updated on 2012-10-18T13:53:16Z at 2012-10-18T13:53:16Z by mburati
  • mburati
    mburati
    425 Posts

    Re: RuntimeException: Could not instantiate parser org.apache.xerces...in WASCE

    ‏2012-10-18T13:53:16Z  
    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
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.