Null pointer exception at org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:278)

From: Ronald Zúñiga (ronaldzo3..mail.com)
Date: Thu Aug 28 2008 - 00:52:55 EDT

  • Next message: Andrey Razumovsky: "Re: Null pointer exception at org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:278)"

    Hi,

    I really need help to find out what is happening here. I was adding an
    object to a parent object. Below you will find all the logging output and
    attached you'll also find my cayenne.xml along with the other xml files from
    my project.

    Thanks in advance for your help!

    Ronald

    -----LOG BEGINS----
    cayenne DEBUG [main 08-27 22:31:16] Configuration: configured log4j from:
    file:/home/ronald/.cayenne/cayenne-log.properties
    cayenne DEBUG [main 08-27 22:31:16] DefaultConfiguration: using domain file
    name: cayenne.xml
    cayenne DEBUG [main 08-27 22:31:16] DefaultConfiguration: canInitialize
    started.
    cayenne DEBUG [main 08-27 22:31:16] DefaultConfiguration: initialize
    starting.
    cayenne DEBUG [main 08-27 22:31:16] ResourceLocator: URL found with
    classloader:
    file:/home/ronald/Projects/Administracion/build/classes/cayenne.xml
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: started
    configuration loading.
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: loaded domain:
    administracion
    cayenne DEBUG [main 08-27 22:31:16] ResourceLocator: URL found with
    classloader:
    file:/home/ronald/Projects/Administracion/build/classes/administracionMap.map.xml
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: loaded <map
    name='administracionMap' location='administracionMap.map.xml'>.
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: loading <node
    name='administracionNode' datasource='administracionNode.driver.xml'
    factory='org.apache.cayenne.conf.DriverDataSourceFactory'>.
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: using factory:
    org.apache.cayenne.conf.DriverDataSourceFactory
    cayenne INFO [main 08-27 22:31:16] DriverDataSourceFactory: loading driver
    information from 'administracionNode.driver.xml'.
    cayenne DEBUG [main 08-27 22:31:16] ResourceLocator: URL found with
    classloader:
    file:/home/ronald/Projects/Administracion/build/classes/administracionNode.driver.xml
    cayenne INFO [main 08-27 22:31:16] DriverDataSourceFactory: loading driver
    org.hsqldb.jdbcDriver
    cayenne INFO [main 08-27 22:31:16] DriverDataSourceFactory: loading user
    name and password.
    cayenne INFO [main 08-27 22:31:16] QueryLogger: Created connection pool:
    jdbc:hsqldb:hsql://localhost/admindb
            Driver class: org.hsqldb.jdbcDriver
            Min. connections in the pool: 1
            Max. connections in the pool: 1
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: loaded datasource.
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: no adapter set,
    using automatic adapter.
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: loaded map-ref:
    administracionMap.
    cayenne DEBUG [main 08-27 22:31:16] Configuration: added domain:
    administracion
    cayenne INFO [main 08-27 22:31:16] RuntimeLoadDelegate: finished
    configuration loading in 227 ms.
    cayenne DEBUG [main 08-27 22:31:16] DefaultConfiguration: initialize
    finished.
    cayenne DEBUG [main 08-27 22:31:16] DefaultConfiguration: didInitialize
    finished.
    cayenne DEBUG [main 08-27 22:31:16] DataRowStore: DataRowStore property
    cayenne.DataRowStore.snapshot.expiration = 7200
    cayenne DEBUG [main 08-27 22:31:16] DataRowStore: DataRowStore property
    cayenne.DataRowStore.snapshot.size = 10000
    cayenne DEBUG [main 08-27 22:31:16] DataRowStore: DataRowStore property
    cayenne.DataRowStore.remote.notify = false
    cayenne DEBUG [main 08-27 22:31:16] DataRowStore: DataRowStore property
    cayenne.DataRowStore.EventBridge.factory =
    org.apache.cayenne.event.JavaGroupsBridgeFactory
    Exception in thread "main" java.lang.NullPointerException
            at
    org.apache.cayenne.CayenneDataObject.addToManyTarget(CayenneDataObject.java:278)
            at administracion.cad.auto._Cliente.addToContactos(_Cliente.java:17)
            at administracion.TestMain.main(TestMain.java:30)

    ---LOG ENDS

    ---Cayenne.xml begins -----
    <?xml version="1.0" encoding="utf-8"?>
    <domains project-version="2.0">
    <domain name="administracion">
        <map name="administracionMap" location="administracionMap.map.xml"/>

        <node name="administracionNode"
             datasource="administracionNode.driver.xml"
             factory="org.apache.cayenne.conf.DriverDataSourceFactory">
                <map-ref name="administracionMap"/>
         </node>
    </domain>
    </domains>
    ---Cayenne.xml ends -----

    ---- AdministrationNode.driver.xml begins -----
    <?xml version="1.0" encoding="utf-8"?>
    <driver project-version="2.0" class="org.hsqldb.jdbcDriver">
        <url value="jdbc:hsqldb:hsql://localhost/admindb"/>
        <connectionPool min="1" max="1" />
        <login userName="sa"/>
    </driver>
    ---- AdministrationNode.driver.xml ends -----

    ---- AdministrationMap.map.xml begins-----
    <?xml version="1.0" encoding="utf-8"?>
    <data-map project-version="2.0">
        <property name="defaultPackage" value="administracion.cad"/>
        <db-entity name="CLIENTE" schema="PUBLIC">
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="CLIENTE_X_EMPRESA" schema="PUBLIC">
            <db-attribute name="CLIENTE_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="EMPRESA_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="CONTACTO" schema="PUBLIC">
            <db-attribute name="CONTACTO" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="PERSONAJURIDICA" type="INTEGER"
    isPrimaryKey="true" isMandatory="true"/>
        </db-entity>
        <db-entity name="EMPRESA" schema="PUBLIC">
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="ENCARGADO" schema="PUBLIC">
            <db-attribute name="PROVEDOR_SERVICIO_ID" type="INTEGER"
    isPrimaryKey="true" isMandatory="true"/>
            <db-attribute name="TRABAJO_ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="FACTURA" schema="PUBLIC">
            <db-attribute name="DESCRIPCION" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="NUMERO" type="VARCHAR" isPrimaryKey="true"
    isMandatory="true" length="100"/>
            <db-attribute name="PROVEDOR" type="INTEGER" isMandatory="true"/>
            <db-attribute name="TOTAL" type="REAL" isMandatory="true"/>
        </db-entity>
        <db-entity name="PERSONA" schema="PUBLIC">
            <db-attribute name="CEDULA" type="VARCHAR" length="50"/>
            <db-attribute name="FAX" type="VARCHAR" length="50"/>
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="NOMBRE" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="TELEFONOS" type="VARCHAR" length="255"/>
            <db-attribute name="UBICACION" type="VARCHAR" length="255"/>
            <db-attribute name="WEB" type="VARCHAR" length="255"/>
        </db-entity>
        <db-entity name="PERSONA_JURIDICA" schema="PUBLIC">
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="REPRESENTANTE_LEGAL" type="INTEGER"/>
        </db-entity>
        <db-entity name="PROVEDOR" schema="PUBLIC">
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="PROVEDOR_SERVICIO" schema="PUBLIC">
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
        </db-entity>
        <db-entity name="TRABAJO" schema="PUBLIC">
            <db-attribute name="CLIENTE_ID" type="INTEGER" isMandatory="true"/>
            <db-attribute name="DESCRIPCION" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="EMPRESA_ID" type="INTEGER" isMandatory="true"/>
            <db-attribute name="ESTADO" type="VARCHAR" isMandatory="true"
    length="50"/>
            <db-attribute name="FECHA_INICIO" type="DATE" isMandatory="true"/>
            <db-attribute name="FECHA_LIMITE" type="DATE" isMandatory="true"/>
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="ORDEN_COMPRA" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="UBICACION" type="VARCHAR" isMandatory="true"
    length="100"/>
        </db-entity>
        <db-entity name="TRABAJO_X_FACTURA" schema="PUBLIC">
            <db-attribute name="FACTURA" type="VARCHAR" isMandatory="true"
    length="100"/>
            <db-attribute name="ID" type="INTEGER" isPrimaryKey="true"
    isMandatory="true"/>
            <db-attribute name="MONTO" type="REAL" isMandatory="true"/>
            <db-attribute name="TRABAJO" type="INTEGER" isMandatory="true"/>
        </db-entity>
        <db-entity name="UBICACION" schema="PUBLIC">
            <db-attribute name="CODIGO" type="VARCHAR" isPrimaryKey="true"
    isMandatory="true" length="100"/>
            <db-attribute name="CONTACTO1" type="INTEGER" isMandatory="true"/>
            <db-attribute name="CONTACTO2" type="INTEGER" isMandatory="true"/>
            <db-attribute name="DESCRIPCION" type="VARCHAR" isMandatory="true"
    length="255"/>
        </db-entity>
        <db-entity name="VEHICULO" schema="PUBLIC">
            <db-attribute name="ANNO" type="INTEGER" isMandatory="true"/>
            <db-attribute name="CHASIS" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="CILINDRADA" type="INTEGER" isMandatory="true"/>
            <db-attribute name="COMBUSTIBLE" type="INTEGER" isMandatory="true"/>
            <db-attribute name="MARCA" type="VARCHAR" isMandatory="true"
    length="50"/>
            <db-attribute name="MODELO" type="VARCHAR" isMandatory="true"
    length="50"/>
            <db-attribute name="MOTOR" type="VARCHAR" isMandatory="true"
    length="255"/>
            <db-attribute name="PLACA" type="VARCHAR" isPrimaryKey="true"
    isMandatory="true" length="20"/>
        </db-entity>
        <obj-entity name="Cliente" superEntityName="Persona"
    className="administracion.cad.Cliente">
        </obj-entity>
        <obj-entity name="Contacto" superEntityName="Persona"
    className="administracion.cad.Contacto">
        </obj-entity>
        <obj-entity name="Empresa" superEntityName="Persona"
    className="administracion.cad.Empresa">
        </obj-entity>
        <obj-entity name="Encargado" className="administracion.cad.Encargado"
    dbEntityName="ENCARGADO">
        </obj-entity>
        <obj-entity name="Factura" className="administracion.cad.Factura"
    dbEntityName="FACTURA">
            <obj-attribute name="descripcion" type="java.lang.String"
    db-attribute-path="DESCRIPCION"/>
            <obj-attribute name="total" type="java.lang.Float"
    db-attribute-path="TOTAL"/>
        </obj-entity>
        <obj-entity name="Persona" className="administracion.cad.Persona"
    dbEntityName="PERSONA">
            <obj-attribute name="cedula" type="java.lang.String"
    db-attribute-path="CEDULA"/>
            <obj-attribute name="fax" type="java.lang.String"
    db-attribute-path="FAX"/>
            <obj-attribute name="nombre" type="java.lang.String"
    db-attribute-path="NOMBRE"/>
            <obj-attribute name="telefonos" type="java.lang.String"
    db-attribute-path="TELEFONOS"/>
            <obj-attribute name="ubicacion" type="java.lang.String"
    db-attribute-path="UBICACION"/>
            <obj-attribute name="web" type="java.lang.String"
    db-attribute-path="WEB"/>
        </obj-entity>
        <obj-entity name="Provedor" className="administracion.cad.Provedor"
    dbEntityName="PROVEDOR">
        </obj-entity>
        <obj-entity name="ProvedorServicio"
    className="administracion.cad.ProvedorServicio"
    dbEntityName="PROVEDOR_SERVICIO">
        </obj-entity>
        <obj-entity name="Trabajo" className="administracion.cad.Trabajo"
    dbEntityName="TRABAJO">
            <obj-attribute name="descripcion" type="java.lang.String"
    db-attribute-path="DESCRIPCION"/>
            <obj-attribute name="estado" type="java.lang.String"
    db-attribute-path="ESTADO"/>
            <obj-attribute name="fechaInicio" type="java.util.Date"
    db-attribute-path="FECHA_INICIO"/>
            <obj-attribute name="fechaLimite" type="java.util.Date"
    db-attribute-path="FECHA_LIMITE"/>
            <obj-attribute name="ordenCompra" type="java.lang.String"
    db-attribute-path="ORDEN_COMPRA"/>
        </obj-entity>
        <obj-entity name="Ubicacion" className="administracion.cad.Ubicacion"
    dbEntityName="UBICACION">
            <obj-attribute name="descripcion" type="java.lang.String"
    db-attribute-path="DESCRIPCION"/>
        </obj-entity>
        <obj-entity name="Vehiculo" className="administracion.cad.Vehiculo"
    dbEntityName="VEHICULO">
            <obj-attribute name="anno" type="java.lang.Integer"
    db-attribute-path="ANNO"/>
            <obj-attribute name="chasis" type="java.lang.String"
    db-attribute-path="CHASIS"/>
            <obj-attribute name="cilindrada" type="java.lang.Integer"
    db-attribute-path="CILINDRADA"/>
            <obj-attribute name="combustible" type="java.lang.Integer"
    db-attribute-path="COMBUSTIBLE"/>
            <obj-attribute name="marca" type="java.lang.String"
    db-attribute-path="MARCA"/>
            <obj-attribute name="modelo" type="java.lang.String"
    db-attribute-path="MODELO"/>
            <obj-attribute name="motor" type="java.lang.String"
    db-attribute-path="MOTOR"/>
        </obj-entity>
        <db-relationship name="contactos" source="CLIENTE" target="CONTACTO"
    toMany="true">
            <db-attribute-pair source="ID" target="PERSONAJURIDICA"/>
        </db-relationship>
        <db-relationship name="cliente" source="CONTACTO" target="CLIENTE"
    toDependentPK="true" toMany="false">
            <db-attribute-pair source="PERSONAJURIDICA" target="ID"/>
        </db-relationship>
        <db-relationship name="persona" source="CONTACTO" target="PERSONA"
    toMany="false">
            <db-attribute-pair source="CONTACTO" target="ID"/>
        </db-relationship>
        <db-relationship name="contacto" source="PERSONA" target="CONTACTO"
    toDependentPK="true" toMany="true">
            <db-attribute-pair source="ID" target="CONTACTO"/>
        </db-relationship>
        <obj-relationship name="contactos" source="Cliente" target="Contacto"
    db-relationship-path="contactos"/>
    </data-map>
    ----AdministrationMap.map.xml ends-----

    -- 
    Ronald Zúñiga Orozco
    Costa Rica
    






    This archive was generated by hypermail 2.0.0 : Thu Aug 28 2008 - 00:53:35 EDT