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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate and doConfigure, Configuration, NullPointer
PostPosted: Sun Aug 28, 2005 7:31 pm 
Newbie

Joined: Wed Sep 01, 2004 10:04 am
Posts: 6
Location: Atlanta, Georgia
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0.5

Mapping documents:
Simple

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

I am getting a Nullpointer exception when calling the 'Configuration.configure(File)

Method.

INFO: configuring from file: Numbers.hbm.xml
Exception in thread "main" java.lang.NullPointerException
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1214)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1146)
at com.numbers.data.NumbersHBMMain.main(Unknown Source)


Here is the code from hibernate Configuration.java

protected Configuration doConfigure(org.dom4j.Document doc) throws HibernateException {

Element sfNode = doc.getRootElement().element( "session-factory" );
String name = sfNode.attributeValue( "name" );
if ( name != null ) properties.setProperty( Environment.SESSION_FACTORY_NAME, name );
addProperties( sfNode );
parseSessionFactory( s


I dont understand why there isnt a a check on 'sfnode' in the code, that is probably where the error is?

This is my bug submit:

if (sfNode != null) {

Also, how would I get past this error.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 7:37 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Can you post the contents of Numbers.hbm.xml ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 7:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Dennis, that would have been an easy to earn credit :) He is trying to feed a mapping file into Hibernate's configuration file method. That obviously doesn't work.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 28, 2005 7:51 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Ah, but not if Numbers.hbm.xml is where <hibernate-configuration> is :->


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