-->
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.  [ 15 posts ] 
Author Message
 Post subject: NPE while expanding tree view
PostPosted: Wed Sep 07, 2005 12:34 am 
Newbie

Joined: Wed Sep 07, 2005 12:25 am
Posts: 2
I'm using Hibernate 3.0.5 and am trying out the Eclipse (3.1) tools (3.1 alpha 5). Yes, I know it's an alpha release, but I'd love to test it out. I'm receiving the following error when trying to expand the tree in the Hibernate configuration pane:

An internal error occurred during: "Fetching children of resolve".
java.lang.NullPointerException
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:123)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:107)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:19)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:68)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)



eclipse.buildId=I20050627-1435
java.version=1.5.0
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86 -clean


I didn't find any information in the FAQ or a forum search; nothing immediately obvious via Google, either. Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 1:13 am 
Newbie

Joined: Wed Sep 07, 2005 12:25 am
Posts: 2
Okay, I got it working through some judicious fiddling...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 4:16 am 
Newbie

Joined: Tue Sep 06, 2005 9:29 am
Posts: 1
Location: Denmark
Have the same problem, how did you solve yours ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 6:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
looking at the code i cant see how you could a NPE at that point - any hints no how to reproduce it ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 8:03 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
I get the same NPE when I give in the Console Configuration wizard as configuration file the hibernate.cfg.xml and in Mapping file the *.hbm.xml . I haven't found yet what's wrong.

_________________
Risto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 8:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you could send me a screenshot of how your console configuraiton and hibernate.cfg.xml looks like it would be helpfull.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 8:32 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
My mistake was not to give the path to jdbc.jar in the classpath window. Adding it caused the NPE to disappear. Now I get

Code:
org.hibernate.MappingException: Resource: opus11/mat/Matemaatikko.hbm.xml not found
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:465)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1404)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1372)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1353)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1329)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1283)
   at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:133)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:123)
   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:107)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:19)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:68)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)


and when I add the path to Matemaatikko.hbm.xml I get:

Code:
org.hibernate.MappingException: Could not read mapping document from file: C:\Porasto\opusEJB\build\opus11\mat\Matemaatikko.hbm.xml
   at org.hibernate.cfg.Configuration.addFile(Configuration.java:262)
   at org.hibernate.console.ConsoleConfiguration$1.execute(ConsoleConfiguration.java:144)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
   at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:123)
   at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:107)
   at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:19)
   at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:68)
   at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
Caused by: org.hibernate.MappingException: duplicate class mapping: opus11.mat.Matemaatikko
   at org.hibernate.cfg.Mappings.addClass(Mappings.java:96)
   at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:157)
   at org.hibernate.cfg.Configuration.add(Configuration.java:378)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:417)
   at org.hibernate.cfg.Configuration.addFile(Configuration.java:259)
   ... 8 more

_________________
Risto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 8:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ahh .... it shouldnt fail with a NPE in that case...fixed in cvs AFAIK.

The others you get a quite "natural"

The first one is becase you didn't have the pojo's in the classpath and the other is because you have added the mappings to both hibernate.cfg.xml and the mappings list.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 8:57 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
So I give the path to the mapping file *.hbm.xml either in the Mapping files window or in the hibernate.cfg.xml, not in both. But without <mapping> element the hibernate.cfg.xml is not valid! I removed it from Mapping files window. It solved the problem. Thanks for the help!

_________________
Risto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 9:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
eh - <mapping> is not required in cfg.xml and haven't been for a long time (even in H2.1.somerelease)

And yes, you only specify it once like you would normally do in hibernate - and if you already have a good hibernate.cfg.xml no need to add it to the mappings list also.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 9:14 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
Good! I don't have to write a separate cfg.xml for the Hibernate Console. I can use the same pair of hibernate.cfg.xml and hibernate.properties as normally.

_________________
Risto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 9:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - only requirement at the moment is that if want the tool to contact the database the connectionmanager must be able to get an connection (which makes datasource connectionmanager defunct in this case)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 9:47 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
Still I fail to open the all-important HQL Editor view ... the Configuration and Session factory are created without errors.

_________________
Risto


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 9:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
and clicking the HQL Editor icon when selecting a configuration doesnt work ? (yes, its small and yes it will be more available in the future ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 10:02 am 
Beginner
Beginner

Joined: Sat Sep 04, 2004 7:07 am
Posts: 20
Location: Helsinki, Finland
aah ... I did find it! Just to the right from viewlabel Hibernate Configurations.

_________________
Risto


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