Hi Jr,

Three things:

        1) Your <mapping> tag is not closed -  you missed the slash ;-)

        2) You missed the transaction context in your test application.
Sourround your query with db.begin() and db.commit()

        3) you have to provide at least one attribute in the sql-tages (my
build throws null pointer exceptions if you don't do so).

sincerly
 Markus

-----Urspr�ngliche Nachricht-----
Von: JR Ruggentaler [mailto:[EMAIL PROTECTED]]
Gesendet: Freitag, 5. April 2002 20:05
An: [EMAIL PROTECTED]
Betreff: Re: [castor-dev] Data source class name does not extend
javax.sql .DataSource


Yes the name of my database xml file is 'database.xml' and the mapping file
is 'ProductGroup.xml'. The mapping file is in the current directory. I and
attaching the files to this email.

J.R.

-----Original Message-----
From: Ned Wolpert [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 11:51 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Data source class name does not extend
javax.sql .DataSource


Is the name of your database xml file 'database.xml'? and is the name of
your mapping file 'mapping.xml'?  The error looks like the mapping file
isn't being found... and its searching for a file called
ProductGroup.xml.  (Which isn't a problem, as long as your mapping file
is called that, and is in your classpath/current directory)

On Fri, 2002-04-05 at 10:35, JR Ruggentaler wrote:
> Ned thanks! I got a bit further but I continue to get and exception from
> jdo.getDatabase();
> 
> org.xml.sax.SAXException: unable to find FieldDescriptor for 'mapping' in
> ClassDescriptor of mapping    at
>
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:81
> 5)    at
>
org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.j
> ava:321)      at
>
org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator
> .java:401)    at
>
org.apache.xerces.impl.XMLNamespaceBinder.startElement(XMLNamespaceBinder.ja
> va:559)       at
>
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidato
> r.java:2678)  at
>
org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java
> :782)         at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDo
> cumentFragmentScannerImpl.java:747)   at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
> her.dispatch(XMLDocumentFragmentScannerImpl.java:1445)        at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocume
> ntFragmentScannerImpl.java:328)       at
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
> nfiguration.java:479)         at
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
> nfiguration.java:521)         at
> org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)         at
>
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:972
> )     at
> org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)   at
> org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:477)
> at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:436)
> at org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:363)    at
>
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.
> java:264)     at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)  at
> CastorTst.<init>(CastorTst.java:19)   at CastorTst.main(CastorTst.java:44)
> 
> 
> Below is the modified database.xml file I am using.
> 
> <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version
> 1.0//EN"
>                            "http://castor.exolab.org/jdo-conf.dtd";>
> <database name="CASTORTST" engine="mysql" >
>    <driver class-name="org.gjt.mm.mysql.Driver"
> url="jdbc:mysql://localhost/CASTORTST" >
>      <param name="user" value="" />
>      <param name="password" value="" />
>    </driver>
>    <mapping href="ProductGroup.xml" />
> </database>
> 
> The ProductGroup.xml is unchanged.
> 
> J.R.
> -----Original Message-----
> From: Ned Wolpert [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 11:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] Data source class name does not extend
> javax.sql.DataSource
> 
> 
> Well, the jdbc driver isn't a data-source.  So you should use the
> <driver> instead of <data-source> in database.xml Like this:
> 
>  <driver class-name="oracle.jdbc.driver.OracleDriver"
>           url="jdbc:oracle:thin:@host:port:SID">
> <param name="user" value="scott" />
> <param name="password" value="tiger" />
> </driver>
> 
> See http://castor.exolab.org/database-conf.html for more info
> 
> On Fri, 2002-04-05 at 09:53, JR Ruggentaler wrote:
> > Hi
> >         I am trying to get a simple example of Castor JDO running. I am
> > using the following database and mapping files:
> > 
> > <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD
Version
> > 1.0//EN"
> >                            "http://castor.exolab.org/jdo-conf.dtd";>
> > <database name="CASTORTST" engine="mysql" >
> >    <data-source class-name="org.gjt.mm.mysql.Driver"
> > url="jdbc:mysql://localhost/CASTORTST" >
> >      <params user="" password="" server-name="localhost" />
> >    </data-source>
> >    <mapping href="ProductGroup.xml" />
> > </database>
> > 
> > <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version
1.0//EN"
> >                            "http://castor.exolab.org/mapping.dtd";>
> > <mapping>
> > 
> >   <!--  Mapping for ProductGroup  -->
> >   <class name="myapp.ProductGroup"
> >          identity="id">
> >     <description>Product group</description>
> >     <map-to table="prod_group" xml="group" />
> >     <field name="id">
> >       <sql/>
> >       <xml node="attribute"/>
> >     </field>
> >     <field name="name">
> >       <sql dirty="check" />
> >       <xml node="text" />
> >     </field>
> >   </class>
> > 
> > <mapping>
> > 
> > I get the following exception when I call jdo.getDatabase();
> > 
> > java.lang.IllegalStateException: Data source class name does not extend
> > javax.sql.DataSource        at
> > org.exolab.castor.jdo.conf.DataSource.createParams(DataSource.java:131)
> > at
> >
>
org.exolab.castor.jdo.conf.DataSourceDescriptor$2.newInstance(DataSourceDesc
> > riptor.java:130)    at
> >
>
org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:10
> > 23)         at
> >
>
org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.j
> > ava:321)    at
> >
>
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXML
> > DocumentParser.java:209)    at
> >
>
org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator
> > .java:420)  at
> >
>
org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.ja
> > va:580)     at
> >
>
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidato
> > r.java:2675)        at
> >
>
org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java
> > :797)       at
> >
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDo
> > cumentFragmentScannerImpl.java:743)         at
> >
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
> > her.dispatch(XMLDocumentFragmentScannerImpl.java:1445)      at
> >
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocume
> > ntFragmentScannerImpl.java:328)     at
> >
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
> > nfiguration.java:479)       at
> >
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserCo
> > nfiguration.java:521)       at
> > org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)       at
> >
>
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:972
> > )   at
> > org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
at
> >
>
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.
> > java:241)   at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)  at
> > CastorTst.<init>(CastorTst.java:19)         at
CastorTst.main(CastorTst.java:44)
> > 
> > 
> > My class path is:
> > C:\Documents and Settings\jr.MPV\My
> >
>
Documents\Downloads\Castor\extract\castor-0.9.3.9\jta1.0.1.jar;C:\Documents
> > and Settings\jr.MPV\My
> >
>
Documents\Downloads\Castor\extract\castor-0.9.3.9\castor-0.9.3.9-xml.jar;C:\
> > Documents and Settings\jr.MPV\My
> >
>
Documents\Downloads\Castor\extract\castor-0.9.3.9\jdbc-se2.0.jar;C:\Document
> > s and Settings\jr.MPV\My
> >
>
Documents\Downloads\Castor\extract\castor-0.9.3.9\castor-0.9.3.9.jar;.;c:\Ka
> >
>
wa4.01\kawaclasses.zip;c:\jdk1.3.1_01\lib\tools.jar;c:\jdk1.3.1_01\jre\lib\r
> > t.jar;c:\jdk1.3.1_01\jre\lib\i18n.jar
> > 
> > Anyone have any ideas what would cause this exception?
> > 
> > J.R.
> > 
> > ----------------------------------------------------------- 
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >     unsubscribe castor-dev
> -- 
> 
> Virtually, 
> Ned Wolpert <[EMAIL PROTECTED]>
> 
> D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45 
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev
-- 

Virtually, 
Ned Wolpert <[EMAIL PROTECTED]>

D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45 

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

Reply via email to