-->
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.  [ 2 posts ] 
Author Message
 Post subject: NPE in SessionFactory creation
PostPosted: Mon Sep 13, 2004 10:50 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Hello All,

The below problem occurs during config.buildSessionFactory() on my Linux and OSX boxes, but not on my Windows XP machine. I haven't disounted a difference in configuration, but I definitely can't find any. It worked on the two broken boxes till I did some changes to the relationships (can't recall which ones may have broken it). As you can see, it gets most of the way through the startup as evidenced by the debug logs. But the Configuration looks to be invalid in some strange way that is applicable only to the two unix machines, and not my windows machine. The mapping files were built with Ant 1.6.2 & XDoclet (same version) in all cases.

The debug logs tell which entities are referenced, but not which entity it is currently parsing in the Second Pass logic, so my hands are tied there.

I'm totally stumped here. Any help would be appreciated, even pointing me to some general area I can look at.

Thanks,

Chris

Hibernate version:
2.1.6

Mapping documents:

Code:
<class name="com.expn.vo.CompanyVO" table="EXP_COMPANY" dynamic-update="false" dynamic-insert="false">
   <id name="id" column="ID" type="java.lang.Long">
      <generator class="sequence">
         <param name="sequence">COMPANY_SEQ</param>
      </generator>
   </id>
   <property name="name" type="java.lang.String" update="true" insert="true" access="property" column="NAME" length="50" not-null="true"/>
   <many-to-one name="address" class="com.expn.vo.AddressVO" cascade="none" outer-join="auto" update="true" insert="true" access="property" column="ADDRESS_ID"/>
   <set name="products" table="EXP_COMPANY_PRODUCT" lazy="true" inverse="false" cascade="all" sort="unsorted">
      <key column="COMPANY_ID">
        </key>
      <many-to-many class="com.expn.vo.ProductVO" column="PRODUCT_ID" outer-join="auto"/>
   </set>
   <property name="creationDate" type="java.util.Date" update="true" insert="true" access="property" column="CREATION_DATE"/>
   <property name="lastModDate" type="java.util.Date" update="true" insert="true" access="property" column="LAST_MOD_DATE"/>
   <property name="createdBy" type="java.lang.Long" update="true" insert="true" access="property" column="CREATED_BY"/>
</class>

<class name="com.expn.vo.ContactVO" table="EXP_CONTACT" dynamic-update="false" dynamic-insert="false">
   <id name="id" column="ID" type="java.lang.Long">
      <generator class="sequence">
         <param name="sequence">CONTACT_SEQ</param>
      </generator>
   </id>
   <property name="firstName" type="java.lang.String" update="true" insert="true" access="property" column="FIRST_NAME" length="50" unique="false"/>
   <property name="lastName" type="java.lang.String" update="true" insert="true" access="property" column="LAST_NAME" length="50" unique="false"/>
   <property name="emailAddress" type="java.lang.String" update="true" insert="true" access="property" column="EMAIL_ADDRESS" length="50" unique="true"/>
   <property name="emailAddressAlt" type="java.lang.String" update="true" insert="true" access="property" column="EMAIL_ADDRESS_ALT" length="50" unique="false"/>
   <many-to-one name="mailingAddress" class="com.expn.vo.AddressVO" cascade="all" outer-join="auto" update="true" insert="true" access="property" column="MAILING_ADDRESS_ID" unique="true"/>
   <one-to-one name="user" class="com.expn.vo.UserVO" cascade="none" outer-join="auto" constrained="false"/>
   <set name="products" table="EXP_CONTACT_PRODUCT" lazy="true" inverse="false" cascade="all" sort="unsorted">
      <key column="CONTACT_ID">
        </key>
      <many-to-many class="com.expn.vo.ProductVO" column="PRODUCT_ID" outer-join="auto"/>
   </set>
   <property name="creationDate" type="java.util.Date" update="true" insert="true" access="property" column="CREATION_DATE"/>
   <property name="lastModDate" type="java.util.Date" update="true" insert="true" access="property" column="LAST_MOD_DATE"/>
   <property name="createdBy" type="java.lang.Long" update="true" insert="true" access="property" column="CREATED_BY"/>
</class>


Full stack trace of any exception that occurs:
java.lang.NullPointerException
at net.sf.hibernate.cfg.Configuration$1.getIdentifierType(Configuration.java:112)
at net.sf.hibernate.type.ManyToOneType.getReferencedType(ManyToOneType.java:23)
at net.sf.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:31)
at net.sf.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:192)
at net.sf.hibernate.mapping.Collection.validate(Collection.java:255)
at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:621)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:785)
at com.expn.database.HibernateManager.initialize(HibernateManager.java:41)
at com.expn.servlet.InitializerServlet.init(InitializerServlet.java:29)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1029)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:903)

Name and version of the database you are using:
Oracle 8i

Debug level Hibernate log excerpt:

10:19:28,210 [DEBUG] {net.sf.hibernate.cfg.Binder} [main] () cfg.Binder$SecondPass.doSecondPass(1368) - Mapped collection key: PRODUCT_ID, element: COMPANY_ID, type: com.expn.vo.CompanyVO
10:19:28,212 [DEBUG] {net.sf.hibernate.cfg.Binder} [main] () cfg.Binder$SecondPass.doSecondPass(1353) - Second pass for collection: com.expn.vo.ProductVO.contacts
10:19:28,214 [DEBUG] {net.sf.hibernate.cfg.Binder} [main] () cfg.Binder$SecondPass.doSecondPass(1368) - Mapped collection key: PRODUCT_ID, element: CONTACT_ID, type: com.expn.vo.ContactVO
10:19:28,215 [INFO ] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompile(636) - processing one-to-one association property references
10:19:28,217 [INFO ] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompile(661) - processing foreign key constraints
10:19:28,219 [DEBUG] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompileForeignKeys(678) - resolving reference to class: com.expn.vo.ProductVO
10:19:28,222 [DEBUG] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompileForeignKeys(678) - resolving reference to class: com.expn.vo.ContactVO
10:19:28,224 [DEBUG] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompileForeignKeys(678) - resolving reference to class: com.expn.vo.AddressVO
10:19:28,225 [DEBUG] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompileForeignKeys(678) - resolving reference to class: com.expn.vo.ContactVO
10:19:28,227 [DEBUG] {net.sf.hibernate.cfg.Configuration} [main] () cfg.Configuration.secondPassCompileForeignKeys(678) - resolving reference to class: com.expn.vo.ContactVO


Top
 Profile  
 
 Post subject: FIXED
PostPosted: Mon Sep 13, 2004 11:44 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
I get more help from myself on this forum than anything else. It seems that no matter how hard I look for the problem, I find the solution about 7ms after I post the problem here.

Thanks to anyone that took time pondering my (non)issue. :)

-Chris


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.