Hi,
you'll have to include Xerces as Castor JDO uses Castor XML to load and analyze
its configuration file.
Werner
wg> -----Urspr�ngliche Nachricht-----
wg> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
wg> Gesendet: Donnerstag, 10. M�rz 2005 14:49
wg> An: [email protected]
wg> Betreff: [castor-user] NoClassDefFoundError [html-removed]
wg>
wg>
wg>
wg> Hi There,
wg> i've justed installed CASTOR and i am trying to work
wg> through my first test
wg> example and i get the following error:
wg>
wg> Am i missing anything? Any ideas whats wrong?
wg> my classpath is
wg>
wg> C:\Java>echo %CLASSPATH%
wg> C:\Java\castor-0.9.6\castor-0.9.6.jar;C:\Java\castor-0.9.6\c
wg> astor-0.9.6-xml.ja
wg> r;
wg> C:\Java\castor-0.9.6\castor-0.9.6-srcgen-ant-task.jar;C:\Jav
wg> a\castor-0.9.6\cas
wg> to
wg> r-0.9.6-xml.jar;C:\Java\castor-0.9.6\jdbc-se2.0.jar;C:\Java\
wg> castor-0.9.6\jta1.
wg> 0.
wg> 1.jar;C:\Tomcat\jConnect-5_5\classes\jconn2.jar;C:\Tomcat\jC
wg> onnect-5_5\classes
wg> \j
wg> TDS2.jar;C:\Tomcat\jakarta-regexp-1.3\jakarta-regexp-1.3.jar
wg> ;\c:\Java;c:\java\
wg> ha
wg> ll;c:\sybtools\ASEP\Monclass.zip;c:\sybtools\ASEP\3pclass.zip;
wg>
wg> C:\Java>java HashTest
wg> #setChildren!
wg> #getChildren!
wg> Here is a key [key1] value [value1]
wg> Here is a key [key2] value [value2]
wg> Exception in thread "main" java.lang.NoClassDefFoundError:
wg> org/apache/xml/serial
wg> ize/XMLSerializer
wg> at
wg> org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:272)
wg> at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:225)
wg> at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:212)
wg> at
wg> org.exolab.castor.mapping.Mapping.loadMappingInternal(Mappin
wg> g.java:52
wg> 7)
wg> at
wg> org.exolab.castor.mapping.Mapping.loadMappingInternal(Mappin
wg> g.java:48
wg> 3)
wg> at org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:410)
wg> at HashTest.main(HashTest.java:42)
wg>
wg> C:\Java>
wg>
wg>
wg>
wg>
wg> Just for completeness, here's the smaple code i've been given:
wg>
wg> import java.util.HashMap;
wg> import java.util.Iterator;
wg> import java.util.Collection;
wg> import java.util.Map;
wg>
wg> import java.io.StringWriter;
wg> import java.io.StringReader;
wg>
wg> import org.exolab.castor.mapping.Mapping;
wg> import org.exolab.castor.mapping.MappingException;
wg>
wg> import org.exolab.castor.xml.Unmarshaller;
wg> import org.exolab.castor.xml.Marshaller;
wg>
wg> import java.io.IOException;
wg> import java.io.FileReader;
wg> import java.io.FileWriter;
wg> import java.io.OutputStreamWriter;
wg>
wg> import org.xml.sax.InputSource;
wg>
wg>
wg> import java.util.HashMap;
wg>
wg> public class HashTest {
wg>
wg> public static void main(String[] args) {
wg>
wg> Root root = new Root();
wg>
wg> HashMap map = new HashMap();
wg> map.put("key1", "value1");
wg> map.put("key2", "value2");
wg>
wg> root.setChildren(map);
wg>
wg> testRoot(root);
wg> Mapping mapping = new Mapping();
wg>
wg> try {
wg> // 1. Load the mapping information from the file
wg> mapping.loadMapping( "mapping.xml" );
wg>
wg> FileWriter writer = new FileWriter("test.xml");
wg> // 4. marshal the data with and print the XML in the console
wg> Marshaller marshaller = new Marshaller(writer);
wg> marshaller.setMapping(mapping);
wg> marshaller.marshal(root);
wg> writer.close();
wg>
wg> FileReader reader = new FileReader("test.xml");
wg> // 2. Unmarshal the data
wg> Unmarshaller unmar = new Unmarshaller(mapping);
wg> Root newRoot = (Root)unmar.unmarshal(reader);
wg>
wg> testRoot(newRoot);
wg>
wg> } catch (Exception e) {
wg> e.printStackTrace();
wg> }
wg> }
wg>
wg> public static void testRoot(Root root) {
wg> Map kids = root.getChildren();
wg> for (Iterator itr = kids.keySet().iterator(); itr.hasNext();)
wg> {
wg> Object key = itr.next();
wg> System.out.println("Here is a key [" + key.toString() +
wg> "] value [" + kids.get(key) + "]");
wg> }
wg>
wg> }
wg> }
wg>
wg>
wg> and
wg>
wg> import java.util.Map;
wg> import java.util.HashMap;
wg>
wg> public class Root {
wg>
wg> HashMap _children = new HashMap();
wg>
wg> public HashMap getChildren() {
wg> System.out.println("#getChildren!");
wg> return _children;
wg> }
wg> public void setChildren(HashMap m) {
wg> System.out.println("#setChildren!");
wg> _children = (HashMap)m;
wg> }
wg> }
wg>
wg>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user