Hello all, I am trying to set up Castor w/MySQL on a RedHat 7.1 machine
and am having a very bad problem.  I am unable to perform the initial
setup of Castor without having an apparently spurious
NoClassDefFoundError.  Here is the test program:

import java.util.*;
import java.net.*;
import org.exolab.castor.jdo.*;
import org.exolab.castor.mapping.*;

import org.apache.xml.serialize.*;
import voxware.app.jdo.*;

public class SetupObjects
{
   public static void main(String[] args) {
     XMLSerializer s = new XMLSerializer();     
     String foo = new String("foo");
     try {
       JDO jdo = new JDO();
       jdo.setDatabaseName("mydb");
       jdo.setClassLoader(foo.getClass().getClassLoader());
       jdo.setConfiguration("file:/home/craigv/app/database.xml");
       System.out.println("INFO: the database configuration URL is " +
jdo.getConfiguration());

       Database db = jdo.getDatabase();
       ...

The stack trace is thus:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/xml/serialize/XMLSerializer
        at
org.exolab.castor.xml.Unmarshaller.initConfig(Unmarshaller.java:257)
        at
org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:213)
        at
org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:200)
        at
org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:508)
        at
org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:423)
        at jdo.Test.<init>(Test.java:92)
        at jdo.Test.main(Test.java:75)

The XMLSerializer class *IS* found earlier with the statement
XMLSerializer s = new XMLSerializer();

so that the JVM should have no problem finding it in Unmarshaller; it is
already loaded!!

I am using JDK 1.4.1, and my class path appears thus:

:/a/j2ee/castor-0.9.5.2.jar:/a/j2ee/openejb-0.9.2/lib/xercesImpl-2.0.2.jar:/a/j2ee/openejb-0.9.2/lib/xml-apis-2.4.D1.jar:/a/j2ee/openejb-0.9.2/lib/ejb-1.0.jar:/usr/java/j2sdk1.4.1_05/jre/lib/ext/mysqljdbc.jar

and my database.xml file is:

<!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD
Version 1.0//EN"
                           "http://castor.exolab.org/jdo-conf.dtd";>
<database name="mysql" engine="mysql" >
<driver class-name="com.mysql.jdbc.Driver" url="jdbc:mysql://m5/test"> 
    <param name="user" value="craigv"/>
    <param name="password" value="" />
  </driver>
  <mapping href="mapping.xml" />
</database>

and I have located "database.xml" within the current directory from
which the test program is run, and that is in the CLASSPATH.  I have
also tried specifying the absolute path with a "file:/.." url.

I spent the entire day trying different things, building the latest
Castor snapshot myself, etc. and nothing I've tried has had any effect -
the NoClassDefFoundError for XMLSerializer persists, even though I can
see that XMLSerializer class is loaded when I run my test program with
"-verbose".  Please help, I am really very stuck.

regards,
craig vanderborgh
voxware incorporated

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to