Software:
- Castor 0.9.4 (JDO-module)
- XDoclet beta 1.2.0 (for generating the mapping.xml-file)
- JDK 1.4.0.
- mySQL + mysql-connector-java-2.0.14

I get an exception when opening the database. My best guess is that this may
be a bug related to missing attributes / tags in the mapping-file. Maybe
someone with experience can tell me what I'm doing wrong?

Thanks!
- Henning





Stacktrace:
------------

java.lang.NullPointerException
        at org.exolab.castor.jdo.engine.JDOClassDescriptor.<init>(Unknown
Source)
        at
org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(Unknown
Source)
        at
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(Unknown Source)
        at org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(Unknown
Source)
        at org.exolab.castor.mapping.Mapping.getResolver(Unknown Source)
        at
org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown Source)
        at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
        at castortest.Test.main(Test.java:63)


Source snippet:
---------------
try
{
    JDO jdo;
    Database db;
   // Define the JDO object
    jdo = new JDO("castortest");
    jdo.setConfiguration("database.xml");
    jdo.setClassLoader(getClass().getClassLoader());

    Class.forName("com.mysql.jdbc.Driver");  // Bug? -Driver not found if I
don't load it explicitly.
     // Obtain a new database
    db = jdo.getDatabase();   // <--- Crash!!    
    ...



The mapping file:
------------------

<?xml version="1.0"?>

<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
                         "http://castor.exolab.org/mapping.dtd";>

<!-- This mapping file is generated by XDoclet. Please do not edit! -->

<mapping>

  <!-- ===================================================================
-->
  <!--   Mapping for class castortest.Person  -->
  <!-- ===================================================================
-->

  <class name="castortest.Person"
         identity="id"
         access="shared"
         auto-complete="false">
    <map-to table="person" />
    <cache-type type="count-limited" />

    <field name="dob"
           type="java.util.Date"
           get-method="getDob">
      <sql
           type="date" />
      <bind-xml />
    </field>

    <field name="id"
           type="integer"
           get-method="getId">
      <sql
           type="integer" />
      <bind-xml />
    </field>

    <field name="name"
           type="java.lang.String"
           get-method="getName">
      <sql
           type="varchar" />
      <bind-xml />
    </field>

  </class>

  <!--
    Define your key-generator declaration in a file called key-generator.xml
and place it in your merge directory.
   -->

</mapping>


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

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

Reply via email to