-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: NullPointerException upon loading of mapping?
PostPosted: Sat Jan 10, 2004 2:25 pm 
Newbie

Joined: Fri Jan 09, 2004 1:02 pm
Posts: 6
I'm playing around with Hibernate and AndroMDA and while it generally works like a charm, it started throwing NullPointerException after me a few compile runs back:

Code:
19:17:15,937 ERROR Configuration:289 - Could not configure datastore from input stream
java.lang.NullPointerException
   at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
   at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:472)
   at net.sf.hibernate.cfg.Binder$2.create(Binder.java:1382)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:989)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:186)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:392)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at com.triligon.addressbook.HibernateUtil.<clinit>(HibernateUtil.java:26)
   at com.triligon.addressbook.Test.main(Test.java:23)
19:17:15,937 ERROR Configuration:189 - Could not configure datastore from file: .\build\hibernateservice\com\triligon\addressbook\Category.hbm.xml
net.sf.hibernate.MappingException: java.lang.NullPointerException
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:290)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:186)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:392)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at com.triligon.addressbook.HibernateUtil.<clinit>(HibernateUtil.java:26)
   at com.triligon.addressbook.Test.main(Test.java:23)
Caused by: java.lang.NullPointerException
   at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
   at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:472)
   at net.sf.hibernate.cfg.Binder$2.create(Binder.java:1382)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:989)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
   ... 9 more
java.lang.ExceptionInInitializerError
   at com.triligon.addressbook.Test.main(Test.java:23)
Caused by: java.lang.RuntimeException: Exception building SessionFactory: net.sf.hibernate.MappingException: java.lang.NullPointerException
   at com.triligon.addressbook.HibernateUtil.<clinit>(HibernateUtil.java:29)
   ... 1 more
Caused by: net.sf.hibernate.MappingException: net.sf.hibernate.MappingException: java.lang.NullPointerException
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:190)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:392)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at net.sf.hibernate.cfg.Configuration.addDirectory(Configuration.java:389)
   at com.triligon.addressbook.HibernateUtil.<clinit>(HibernateUtil.java:26)
   ... 1 more
Caused by: net.sf.hibernate.MappingException: java.lang.NullPointerException
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:290)
   at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:186)
   ... 8 more
Caused by: java.lang.NullPointerException
   at net.sf.hibernate.util.StringHelper.qualify(StringHelper.java:241)
   at net.sf.hibernate.cfg.Binder.bindCollection(Binder.java:472)
   at net.sf.hibernate.cfg.Binder$2.create(Binder.java:1382)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:989)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
   ... 9 more
Exception in thread "main"




and the mapping file is (IMHO it's correct):

Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 1.1//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-1.1.dtd">

<hibernate-mapping>
    <class
        name="com.triligon.addressbook.Category"
        table="CATEGORY"
    >

        <id
            name="categoryID"
            column="CATEGORY_I_D"
            type="java.lang.String"
        >
            <generator class="uuid.hex">
            </generator>
        </id>

        <discriminator
            column="class"
            type="string"
        />

        <property
            name="name"
            type="java.lang.String"
        >
            <column
                name="NAME"
                sql-type="VARCHAR(255)"
            />
        </property>

        <set
            role="people"
            table="CATEGORIES_CATEGORY_I_D_PEOPLE_PERSON_I_D"
            lazy="true"
            readonly="false"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="CATEGORIES_CATEGORY_I_D"
              />

              <many-to-many
                  class="com.triligon.addressbook.Person"
                  column="PEOPLE_PERSON_I_D"
                  outer-join="auto"
              />

        </set>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Category.xml
            containing the additional properties and place it in your merge dir.
        -->
        <subclass
            name="com.triligon.addressbook.CategoryImpl"
            discriminator-value="CategoryImpl"
        >

        </subclass>

    </class>

</hibernate-mapping>


To make things even weirder, it will parse the first mapping file correctly but whichever comes next will fail (i.e. if I delete this mapping and let it go straight to the next that one will fail but work if it's all alone). I'm using addDirectory() to let hibernate pick up the mappings automatically.


Top
 Profile  
 
 Post subject: Re: NullPointerException upon loading of mapping?
PostPosted: Sat Jan 10, 2004 2:42 pm 
Newbie

Joined: Fri Jan 09, 2004 1:02 pm
Posts: 6
Quote:
To make things even weirder, it will parse the first mapping file correctly but whichever comes next will fail (i.e. if I delete this mapping and let it go straight to the next that one will fail but work if it's all alone). I'm using addDirectory() to let hibernate pick up the mappings automatically.


Actually, it seems to fail on the mapping if it is the only one, as well, so it's reproduceable at least.


Top
 Profile  
 
 Post subject: "Solved", it must be an andromda problem with rela
PostPosted: Sat Jan 10, 2004 2:53 pm 
Newbie

Joined: Fri Jan 09, 2004 1:02 pm
Posts: 6
as if I delete the relations and regenerate my code, it works. So it's not a hibernate problem I think.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.