Hi!

I'm new in using this Castor stuff and I'm currently using it
with the VAJ environment.  Yet, I'm having a problem if in
Marshalling and Unmarshalling my xml files when I am pointing
my dtd to the SYSTEM instead of PUBLIC.  What I meant is, VAJ
will give me a FileNotNotFoundException for the mapping.dtd.
Is anyone has encountered this type of problem before? I have
the dtd file in the resources directory of my VAJ project and
still I got this exception.  Need your suggestions...

Thanks.
Charlie

Tom Drake wrote:
> 
> Roshani:
> 
> There is no file in the castor distribution named
> ''org.exolab.castor.util.resources.messages".
>  There is a file named
> "org.exolab.castor.util.resources.messages.properties", however.
> 
> Clearly, your classpath is 'correct' because you are actually invoking code
> found in the castor library.
> 
> - Make certain that the classpath settings in VAJ point to the castor jar
> file.
>   If you've built castor from the sources or extracted the contents of the
> jar file,
>   you may not have everything in the right place. If using the jar file
> (from the pre-built distribution)
>   doesn't work, then, either you've got an environment problem, a bad castor
> library, or you've
>   got a problem with your code.
> 
> - Try running program from the command-line using Suns 'java'.
>   If it works (and it should), then you can guarantee that you've got an
>   environment problem with VAJ.
> 
> - If your code doesn't work, try extracting the sample code from the
> examples.zip file and follow the instructions for the 'InvoiceTest' example
> application. If that works, try making your code look more like the example
> app.
> 
> Hope this helps.
> 
> ----- Original Message -----
> From: "Roshani Bhatt" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 19, 2001 10:53 AM
> Subject: Re: [castor-dev] Marshalling Error
> 
> | Tom,
> |      I don't have a mapping.xml file.  I am trying to
> | convert the class to xml file without using any
> | mapping.  I am using VAJ to complie/run the program.
> | I get the following error:  "[castor] Failed to locate
> | messages resource
> | org.exolab.castor.util.resources.messages".
> |
> | When I debug this program it fails in
> | public ClassDescriptorResolverImp() method -
> | _introspector = new Introspector(); line -
> |
> | I am not sure why this is happening.  Is it trying to
> | looking for some file?  Any suggestions?
> |
> | Thanks,
> | Roshani
> | --- Tom Drake <[EMAIL PROTECTED]> wrote:
> | > Roshani:
> | >
> | > I'm not sure why you're getting this error. However,
> | > I will advise you not
> | > to use the static 'Marshaller.marshal' method. It
> | > will not pick up your
> | > mapping.xml file. You should instantiate your own
> | > mapping and marshall your
> | > objects with code that looks something like this:
> | >
> | >     private static org.exolab.castor.mapping.Mapping
> | > sMapping = null;
> | >
> | >     private static synchronized void initMapping()
> | > throws Exception {
> | >       sMapping = new
> | > org.exolab.castor.mapping.Mapping();
> | >       String mappingUrl = "mapping.xml";
> | >       sMapping.setBaseURL(mappingUrl);
> | >       sMapping.loadMapping(mappingUrl);
> | >     }
> | >
> | >     private static void toXml(Object obj) throws
> | > Exception {
> | >        if (sMapping == null) { initMapping(); }
> | >
> | >       Marshaller converter = new Marshaller(new
> | > java.io.PrintWriter(System.out));
> | >       converter.setMapping(sMapping);
> | >
> | >       converter.setMarshalAsDocument(addXmlTag);
> | >         converter.marshal(object);
> | >    }
> | >
> | >
> | > ----- Original Message -----
> | > From: "Roshani Bhatt" <[EMAIL PROTECTED]>
> | > To: <[EMAIL PROTECTED]>
> | > Sent: Wednesday, October 17, 2001 10:28 AM
> | > Subject: [castor-dev] Marshalling Error
> | >
> | >
> | > | I have a 'Person' Class with one attribute -name.
> | > I
> | > | am trying to use the castor to create an xml file
> | > but
> | > | I am getting the following error:
> | > |
> | > | Thread[main,5,main] (Alive): Uncaught exception
> | > | (java.lang.ExceptionInInitializerError)
> | > | ClassDescriptorResolverImpl()
> | > | Marshaller.initialize()
> | > | Marshaller(Writer)
> | > | Marshaller.marshal(Object, Writer)
> | > | Person.main(String [])
> | > |
> | > |
> | > | Do you have any suggestions?  This is how my code
> | > | looks:
> | > |
> | > | /package gov.test;
> | > |
> | > | import java.util.*;
> | > | import java.io.IOException;
> | > | import java.io.FileReader;
> | > | import java.io.FileWriter;
> | > | import java.io.OutputStreamWriter;
> | > |
> | > | import org.exolab.castor.mapping.Mapping;
> | > | import org.exolab.castor.mapping.MappingException;
> | > |
> | > | import org.exolab.castor.xml.Unmarshaller;
> | > | import org.exolab.castor.xml.Marshaller;
> | > |
> | > | import org.xml.sax.InputSource;
> | > | public class Person implements
> | > java.io.Serializable
> | > | {
> | > |
> | > |    /**
> | > |      * The name of the person
> | > |      */
> | > |    private String name = "xxx";
> | > |
> | > |
> | > |
> | > | /**
> | > |  * Person constructor comment.
> | > |  */
> | > | public Person() {
> | > | super();
> | > | }
> | > |    /**
> | > |      * Creates a Person with the given name
> | > |      */
> | > |    public Person(String name) {
> | > |       this.name  = name;
> | > |    }
> | > |    /**
> | > |      * @return name of the person
> | > |      */
> | > |    public String getName() {
> | > |       return name;
> | > |    }
> | > | /**
> | > |  * Insert the method's description here.
> | > |  * Creation date: (10/16/01 1:31:04 PM)
> | > |  * @param args java.lang.String[]
> | > |  */
> | > | public static void main(String[] args) {
> | > |
> | > | // Create a new Person
> | > | Person person = new Person("Ryan 'Mad Dog'
> | > Madden");
> | > |
> | > |
> | > | try{
> | > | // Create a File to marshal to
> | > | String filename = "D:\\test.xml";
> | > | FileWriter writer = new FileWriter(filename);
> | > |
> | > | // Marshal the person object
> | > | Marshaller.marshal(person, writer);
> | > | }
> | > | catch (Exception e)
> | > | {System.out.println ("Marshall failed - RB");
> | > | }
> | > |
> | > |
> | > |
> | > |
> | > |
> | > |
> | > | }
> | > |    /**
> | > |      * Sets the name of the person
> | > |      * @param name the name of the person
> | > |      */
> | > |    public void setName(String name) {
> | > |       this.name = name;
> | > |    }
> | > | }
> | > |
> | > |
> | > |
> | > |
> | > | __________________________________________________
> | > | Do You Yahoo!?
> | > | Make a great connection at Yahoo! Personals.
> | > | http://personals.yahoo.com
> | > |
> | > |
> | >
> | -----------------------------------------------------------
> | > | If you wish to unsubscribe from this mailing, send
> | > mail to
> | > | [EMAIL PROTECTED] with a subject of:
> | > | unsubscribe castor-dev
> | > |
> | > |
> | > |
> | >
> | >
> | -----------------------------------------------------------
> | >
> | > If you wish to unsubscribe from this mailing, send
> | > mail to
> | > [EMAIL PROTECTED] with a subject of:
> | > unsubscribe castor-dev
> | >
> |
> |
> | __________________________________________________
> | Do You Yahoo!?
> | Make a great connection at Yahoo! Personals.
> | http://personals.yahoo.com
> |
> | -----------------------------------------------------------
> | If you wish to unsubscribe from this mailing, send mail to
> | [EMAIL PROTECTED] with a subject of:
> | unsubscribe castor-dev
> |
> |
> |
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

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

Reply via email to